Add SEO stuff
- <head> related SEO - Twitter Cards and Open Graph metas - Webmaster tool verifications
This commit is contained in:
parent
7139d61c62
commit
fec3508b5d
5 changed files with 167 additions and 44 deletions
23
_config.yml
23
_config.yml
|
@ -8,10 +8,32 @@
|
||||||
# Site Settings
|
# Site Settings
|
||||||
locale : en_US
|
locale : en_US
|
||||||
title : "Your awesome site"
|
title : "Your awesome site"
|
||||||
|
name : "Your Name"
|
||||||
|
title_separator : "-"
|
||||||
description : "Write an awesome description for your new site here."
|
description : "Write an awesome description for your new site here."
|
||||||
url : "http://localhost:4000" # the base hostname & protocol for your site
|
url : "http://localhost:4000" # the base hostname & protocol for your site
|
||||||
baseurl : "/test" # the subpath of your site, e.g. /blog
|
baseurl : "/test" # the subpath of your site, e.g. /blog
|
||||||
email : "your-email@domain.com"
|
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
|
# Reading Files
|
||||||
safe: false
|
safe: false
|
||||||
|
@ -98,7 +120,6 @@ owner:
|
||||||
google :
|
google :
|
||||||
plus :
|
plus :
|
||||||
analytics :
|
analytics :
|
||||||
verify :
|
|
||||||
ad-client :
|
ad-client :
|
||||||
ad-slot :
|
ad-slot :
|
||||||
instagram :
|
instagram :
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<img src="{{ author.avatar | prepend: absurl }}" class="author-avatar" alt="{{ author.name }} photo">
|
<img src="{{ author.avatar | prepend: absurl }}" class="author-avatar" alt="{{ author.name }} photo">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3 itemprop="name" class="author-name">{{ author.name }}</h3>
|
<h3 class="author-name">{{ author.name }}</h3>
|
||||||
{% if author.bio %}<p class="author-bio">{{ author.bio }}</p>{% endif %}
|
{% if author.bio %}<p class="author-bio">{{ author.bio }}</p>{% endif %}
|
||||||
{% if author.email %}
|
{% if author.email %}
|
||||||
<a href="mailto:{{ author.email }}" class="author-social" target="_blank"><i class="fa fa-fw fa-envelope-square"></i> Email</a>
|
<a href="mailto:{{ author.email }}" class="author-social" target="_blank"><i class="fa fa-fw fa-envelope-square"></i> Email</a>
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>{% if page.title %}{{ page.title }} – {% endif %}{{ site.title }}</title>
|
|
||||||
{% if page.excerpt %}<meta name="description" content="{{ page.excerpt | strip_html }}">{% endif %}
|
|
||||||
<meta name="keywords" content="{{ page.tags | join: ', ' }}">
|
|
||||||
{% 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 %}<!-- Webmaster Tools verfication -->
|
|
||||||
<meta name="google-site-verification" content="{{ site.owner.google.verify }}">{% endif %}
|
|
||||||
{% if site.owner.bing-verify %}<meta name="msvalidate.01" content="{{ site.owner.bing-verify }}">{% endif %}
|
|
||||||
|
|
||||||
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: absurl }}">
|
|
||||||
<link href="{{ absurl }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
|
<link href="{{ absurl }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
|
||||||
|
|
||||||
<!-- http://t.co/dKP3o1e -->
|
<!-- http://t.co/dKP3o1e -->
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!-- Twitter Cards -->
|
|
||||||
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
|
|
||||||
{% if page.excerpt %}<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">{% endif %}
|
|
||||||
{% if site.owner.twitter %}<meta name="twitter:site" content="@{{ site.owner.twitter }}">{% endif %}
|
|
||||||
{% if author.twitter %}<meta name="twitter:creator" content="@{{ author.twitter }}">{% endif %}
|
|
||||||
{% if page.image.feature %}
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<meta name="twitter:image" content="{{ site.url }}/images/{{ page.image.feature }}">
|
|
||||||
{% else %}
|
|
||||||
<meta name="twitter:card" content="summary">
|
|
||||||
<meta name="twitter:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/default-thumb.png{% endif %}">
|
|
||||||
{% endif %}
|
|
||||||
<!-- Open Graph -->
|
|
||||||
<meta property="og:locale" content="{{ site.locale }}">
|
|
||||||
<meta property="og:type" content="article">
|
|
||||||
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
|
|
||||||
{% if page.excerpt %}<meta property="og:description" content="{{ page.excerpt | strip_html }}">{% endif %}
|
|
||||||
<meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.url }}">
|
|
||||||
<meta property="og:site_name" content="{{ site.title }}">
|
|
||||||
{% if page.image.feature %}
|
|
||||||
<meta property="og:image" content="{{ site.url }}/images/{{ page.image.feature }}">
|
|
||||||
{% else %}
|
|
||||||
<meta property="og:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/default-thumb.png{% endif %}">
|
|
||||||
{% endif %}
|
|
137
_includes/seo.html
Normal file
137
_includes/seo.html
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
<!-- begin SEO -->
|
||||||
|
{% 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 %}
|
||||||
|
<title>{{ seo_title }}</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 %}
|
||||||
|
|
||||||
|
<meta property="og:locale" content="{{ site.locale }}">
|
||||||
|
<meta property="og:site_name" content="{{ site.title }}">
|
||||||
|
|
||||||
|
{% if page.title %}
|
||||||
|
<meta property="og:title" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if seo_url %}
|
||||||
|
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace:"/index.html", "/" }}" />
|
||||||
|
<meta property="og:url" content="{{ page.url | prepend: seo_url | replace:"/index.html", "/" }}" />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.excerpt %}
|
||||||
|
<meta property="og:description" content="{{ seo_description }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.twitter %}
|
||||||
|
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@", "" }}" />
|
||||||
|
<meta name="twitter:title" content="{{ seo_title }}" />
|
||||||
|
<meta name="twitter:description" content="{{ seo_description }}" />
|
||||||
|
<meta name="twitter:url" content="{{ canonical_url }}">
|
||||||
|
|
||||||
|
{% if page.image.feature %}
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="{{ page.image.feature | prepend: "/images/" | prepend: absurl }}">
|
||||||
|
{% else %}
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
<meta name="twitter:image" content="{% if page.image.thumb %}{{ page.image.thumb | prepend: "/images/" | prepend: absurl }}{% else %}{{ site.logo | prepend: "/images/" | prepend: absurl }}{% endif %}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if seo_author_twitter %}
|
||||||
|
<meta name="twitter:creator" content="@{{ seo_author_twitter }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.facebook %}
|
||||||
|
{% if site.facebook.publisher %}
|
||||||
|
<meta property="article:publisher" content="{{ site.facebook.publisher }}" />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.facebook.app_id %}
|
||||||
|
<meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.image.feature %}
|
||||||
|
<meta property="og:image" content="{{ page.image.feature | prepend: "/images/" | prepend: absurl }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.date %}
|
||||||
|
<meta property="og:type" content="article">
|
||||||
|
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
|
||||||
|
{% if page.next.url %}
|
||||||
|
<link rel="next" href="{{ page.next.url | prepend: seo_url | replace:"/index.html", "/" }}" title="{{ page.next.title | escape }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% if page.previous.url %}
|
||||||
|
<link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace:"/index.html", "/" }}" title="{{ page.previous.title | escape }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.logo %}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "Organization",
|
||||||
|
"url": {{ seo_url | jsonify }},
|
||||||
|
"logo": {{ site.logo | prepend: "/" | prepend: seo_url | jsonify }}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.social %}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context" : "http://schema.org",
|
||||||
|
"@type" : "{% if site.social.type %}{{ site.social.type }}{% else %}person{% endif %}",
|
||||||
|
"name" : "{% if site.social.name %}{{ site.social.name }}{% else %}{{ site.name }}{% endif %}",
|
||||||
|
"url" : {{ seo_url | jsonify }},
|
||||||
|
"sameAs" : {{ site.social.links | jsonify }}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if site.google_site_verification %}
|
||||||
|
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% if site.bing_site_verification %}
|
||||||
|
<meta name="msvalidate.01" content="{{ site.bing_site_verification }}">
|
||||||
|
{% endif %}
|
||||||
|
{% if site.owner.alexa.verify %}
|
||||||
|
<meta name="alexaVerifyID" content="{{ site.alexa_site_verification }}">
|
||||||
|
{% endif %}
|
||||||
|
{% if site.owner.yandex.verify %}
|
||||||
|
<meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
|
||||||
|
{% endif %}
|
||||||
|
<!-- end SEO -->
|
Loading…
Reference in a new issue