From fec3508b5d8ed62318793950818b80aa420e51a3 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 23 Feb 2016 00:17:39 -0500 Subject: [PATCH] Add SEO stuff - related SEO - Twitter Cards and Open Graph metas - Webmaster tool verifications --- _config.yml | 35 +++++++-- _includes/author-profile.html | 2 +- _includes/head.html | 13 +--- _includes/open-graph.html | 24 ------ _includes/seo.html | 137 ++++++++++++++++++++++++++++++++++ 5 files changed, 167 insertions(+), 44 deletions(-) delete mode 100644 _includes/open-graph.html create mode 100644 _includes/seo.html diff --git a/_config.yml b/_config.yml index 3c1923d2..59736b23 100644 --- a/_config.yml +++ b/_config.yml @@ -6,12 +6,34 @@ # 'jekyll serve'. If you change this file, please restart the server process. # Site Settings -locale : en_US -title : "Your awesome site" -description : "Write an awesome description for your new site here." -url : "http://localhost:4000" # the base hostname & protocol for your site -baseurl : "/test" # the subpath of your site, e.g. /blog -email : "your-email@domain.com" +locale : en_US +title : "Your awesome site" +name : "Your Name" +title_separator : "-" +description : "Write an awesome description for your new site here." +url : "http://localhost:4000" # the base hostname & protocol for your site +baseurl : "/test" # the subpath of your site, e.g. /blog +email : "your-email@domain.com" +logo : "images/default-thumb.png" +google_site_verification : +twitter: + username : site_twitter +facebook: + app_id : 1234 + publisher : 1234 +google_site_verification : +bing_site_verification : +alexa_site_verification : +yandex_site_verification : + +# For specifying social profiles. +# https://developers.google.com/structured-data/customize/social-profiles +social: + type : # person or organization (defaults to person) + name : # If the user or organization name differs from the site's name + links: # An array of links to social media profiles + - "https://twitter.com/site_twitter" + - "https://facebook.com/site_facebook" # Reading Files safe: false @@ -98,7 +120,6 @@ owner: google : plus : analytics : - verify : ad-client : ad-slot : instagram : diff --git a/_includes/author-profile.html b/_includes/author-profile.html index fe12998a..520d2764 100644 --- a/_includes/author-profile.html +++ b/_includes/author-profile.html @@ -10,7 +10,7 @@ {{ author.name }} photo {% endif %} -

{{ author.name }}

+

{{ author.name }}

{% if author.bio %}

{{ author.bio }}

{% endif %} {% if author.email %} Email diff --git a/_includes/head.html b/_includes/head.html index 1d5c8da6..8eac067d 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,18 +1,7 @@ -{% if page.title %}{{ page.title }} – {% endif %}{{ site.title }} -{% if page.excerpt %}{% endif %} - -{% if page.author %} - {% assign author = site.data.authors[page.author] %}{% else %}{% assign author = site.owner %} -{% endif %} -{% include open-graph.html %} +{% include seo.html %} -{% if site.owner.google.verify %} -{% endif %} -{% if site.owner.bing-verify %}{% endif %} - - diff --git a/_includes/open-graph.html b/_includes/open-graph.html deleted file mode 100644 index 2e1db2cf..00000000 --- a/_includes/open-graph.html +++ /dev/null @@ -1,24 +0,0 @@ - - -{% if page.excerpt %}{% endif %} -{% if site.owner.twitter %}{% endif %} -{% if author.twitter %}{% endif %} -{% if page.image.feature %} - - -{% else %} - - -{% endif %} - - - - -{% if page.excerpt %}{% endif %} - - -{% if page.image.feature %} - -{% else %} - -{% endif %} \ No newline at end of file diff --git a/_includes/seo.html b/_includes/seo.html new file mode 100644 index 00000000..df7d7b5e --- /dev/null +++ b/_includes/seo.html @@ -0,0 +1,137 @@ + +{% if site.url %} + {% assign seo_url = site.url | append: site.baseurl %} +{% endif %} +{% assign seo_url = seo_url | default: site.github.url %} + +{% if page.title %} + {% assign seo_title = page.title | append: " " | append: site.title_separator | append: " " | append: site.title %} +{% endif %} + +{% if seo_title %} + {% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %} +{% endif %} + +{% if site.url %} + {% assign canonical_url = page.url | replace: "index.html", "" | prepend: site.url %} +{% endif %} + +{% if seo_title %} + {{ seo_title }} +{% endif %} + +{% assign seo_description = page.description | default: page.excerpt | default: site.description %} +{% if seo_description %} + {% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %} +{% endif %} + +{% assign seo_author = page.author | default: page.authors[0] | default: site.author %} +{% if seo_author %} + {% if seo_author.twitter %} + {% assign seo_author_twitter = seo_author.twitter %} + {% else %} + {% if site.data.authors and site.data.authors[seo_author] %} + {% assign seo_author_twitter = site.data.authors[seo_author].twitter %} + {% else %} + {% assign seo_author_twitter = seo_author %} + {% endif %} + {% endif %} + {% assign seo_author_twitter = seo_author_twitter | replace:"@", "" %} +{% endif %} + + + + +{% if page.title %} + +{% endif %} + +{% if seo_url %} + + +{% endif %} + +{% if page.excerpt %} + +{% endif %} + +{% if site.twitter %} + + + + + + {% if page.image.feature %} + + + {% else %} + + + {% endif %} + + {% if seo_author_twitter %} + + {% endif %} +{% endif %} + +{% if site.facebook %} + {% if site.facebook.publisher %} + + {% endif %} + + {% if site.facebook.app_id %} + + {% endif %} +{% endif %} + +{% if page.image.feature %} + +{% endif %} + +{% if page.date %} + + + {% if page.next.url %} + + {% endif %} + {% if page.previous.url %} + + {% endif %} +{% endif %} + +{% if site.logo %} + +{% endif %} + +{% if site.social %} + +{% endif %} + +{% if site.google_site_verification %} + +{% endif %} +{% if site.bing_site_verification %} + +{% endif %} +{% if site.owner.alexa.verify %} + +{% endif %} +{% if site.owner.yandex.verify %} + +{% endif %} + \ No newline at end of file