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
+14 -17
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 }}
}