Improve SEO include

This commit is contained in:
Michael Rose 2016-02-23 10:13:15 -05:00
parent fec3508b5d
commit d14a360cd3
3 changed files with 19 additions and 21 deletions

View file

@ -14,13 +14,13 @@ 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"
logo : "default-thumb.png"
google_site_verification :
twitter:
username : site_twitter
facebook:
app_id : 1234
publisher : 1234
app_id :
publisher :
google_site_verification :
bing_site_verification :
alexa_site_verification :
@ -29,7 +29,7 @@ yandex_site_verification :
# For specifying social profiles.
# https://developers.google.com/structured-data/customize/social-profiles
social:
type : # person or organization (defaults to person)
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"

View file

@ -36,19 +36,16 @@
{% assign seo_author_twitter = seo_author %}
{% endif %}
{% endif %}
{% assign seo_author_twitter = seo_author_twitter | replace:"@", "" %}
{% 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 %}
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
{% 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", "/" }}" />
<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 %}
@ -56,9 +53,9 @@
{% 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:site" content="@{{ site.twitter.username | replace: "@", "" }}">
<meta name="twitter:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
<meta name="twitter:description" content="{{ seo_description }}">
<meta name="twitter:url" content="{{ canonical_url }}">
{% if page.image.feature %}
@ -70,17 +67,17 @@
{% endif %}
{% if seo_author_twitter %}
<meta name="twitter:creator" content="@{{ 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 }}" />
<meta property="article:publisher" content="{{ site.facebook.publisher }}">
{% endif %}
{% if site.facebook.app_id %}
<meta property="fb:app_id" content="{{ site.facebook.app_id }}" />
<meta property="fb:app_id" content="{{ site.facebook.app_id }}">
{% endif %}
{% endif %}
@ -90,12 +87,12 @@
{% if page.date %}
<meta property="og:type" content="article">
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
<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 }}" />
<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 }}" />
<link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace: "/index.html", "/" }}" title="{{ page.previous.title | escape }}">
{% endif %}
{% endif %}
@ -115,7 +112,7 @@
{
"@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 %}",
"name" : "{{ site.social.name | default: site.name }}",
"url" : {{ seo_url | jsonify }},
"sameAs" : {{ site.social.links | jsonify }}
}

View file

@ -22,6 +22,7 @@ layout: compress
"{{ page.image.feature }}"
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
"{{ page.image.feature | prepend: absurl }}"
{% endif %}
alt="{{ page.title }}">
{% if page.image.credit %}