jekyll-seo-tag/lib/template.html

177 lines
5.5 KiB
HTML
Raw Normal View History

2016-02-20 19:26:06 +00:00
<!-- Begin Jekyll SEO tag v{{ seo_tag.version }} -->
2015-10-25 21:21:46 +00:00
{% if site.url %}
2016-01-06 18:00:20 +00:00
{% assign seo_url = site.url | append: site.baseurl %}
{% endif %}
2016-01-29 18:35:40 +00:00
{% assign seo_url = seo_url | default: site.github.url %}
{% assign seo_site_title = site.title | default: site.name %}
2015-10-25 21:21:46 +00:00
{% if page.title %}
{% assign seo_title = page.title %}
2016-01-05 22:59:46 +00:00
{% assign seo_page_title = page.title %}
2016-02-09 23:33:53 +00:00
{% if seo_site_title %}
{% assign seo_title = seo_title | append:" - " | append: seo_site_title %}
2015-10-25 21:21:46 +00:00
{% endif %}
{% elsif seo_site_title %}
{% assign seo_title = seo_site_title %}
{% assign seo_page_title = seo_site_title %}
2016-02-09 23:33:53 +00:00
2016-01-12 22:15:22 +00:00
{% if site.description %}
{% assign seo_title = seo_title | append:" - " | append: site.description %}
{% endif %}
2015-10-25 21:21:46 +00:00
{% endif %}
2016-02-09 23:33:53 +00:00
2015-10-25 21:21:46 +00:00
{% if seo_title %}
2015-10-31 18:05:19 +00:00
{% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %}
2015-10-25 21:21:46 +00:00
{% endif %}
2016-02-09 23:33:53 +00:00
{% if seo_site_title %}
{% assign seo_site_title = seo_site_title | markdownify | strip_html | strip_newlines | escape_once %}
{% endif %}
2016-02-09 23:33:53 +00:00
2016-01-05 22:59:46 +00:00
{% if seo_page_title %}
{% assign seo_page_title = seo_page_title | markdownify | strip_html | strip_newlines | escape_once %}
{% endif %}
2015-10-25 21:21:46 +00:00
2016-01-29 18:35:40 +00:00
{% assign seo_description = page.description | default: page.excerpt | default: site.description %}
2015-10-25 21:21:46 +00:00
{% if seo_description %}
2015-10-31 18:05:19 +00:00
{% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
2015-10-25 21:21:46 +00:00
{% endif %}
2016-02-21 18:52:49 +00:00
{% assign seo_author = page.author | default: page.authors[0] | default: site.author %}
2016-02-20 22:34:02 +00:00
{% 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:"@","" %}
2016-01-12 20:09:43 +00:00
{% endif %}
{% if seo_tag.title and seo_title %}
2015-10-25 21:21:46 +00:00
<title>{{ seo_title }}</title>
2016-01-05 22:59:46 +00:00
{% endif %}
{% if seo_title %}
<meta property="og:title" content="{{ seo_page_title }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
{% if seo_description %}
<meta name="description" content="{{ seo_description }}" />
<meta property='og:description' content="{{ seo_description }}" />
{% endif %}
{% if seo_url %}
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" />
2016-01-06 17:52:26 +00:00
<meta property='og:url' content='{{ page.url | prepend: seo_url | replace:'/index.html','/' }}' />
2015-10-25 21:21:46 +00:00
{% endif %}
{% if seo_site_title %}
<meta property="og:site_name" content="{{ seo_site_title }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
{% if page.image %}
<meta property="og:image" content="{{ page.image | prepend: "/" | prepend: seo_url | escape }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
{% if page.date %}
<meta property="og:type" content="article" />
2016-02-03 17:52:46 +00:00
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" />
2015-10-25 21:21:46 +00:00
{% if page.next.url %}
2016-01-06 17:52:26 +00:00
<link rel="next" href="{{ page.next.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.next.title | escape }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
2016-02-09 23:33:53 +00:00
2015-10-25 21:21:46 +00:00
{% if page.previous.url %}
2016-01-06 17:52:26 +00:00
<link rel="prev" href="{{ page.previous.url | prepend: seo_url | replace:'/index.html','/' }}" title="{{ page.previous.title | escape }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
{% endif %}
{% if site.twitter %}
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
<meta name="twitter:title" content="{{ seo_title }}" />
<meta name="twitter:description" content="{{ seo_description }}" />
2016-02-09 23:33:53 +00:00
2015-10-25 21:21:46 +00:00
{% if page.image %}
<meta name="twitter:image" content="{{ page.image | escape }}" />
{% endif %}
2016-02-09 23:33:53 +00:00
2016-01-12 20:09:43 +00:00
{% if seo_author_twitter %}
2016-02-20 20:49:35 +00:00
<meta name="twitter:creator" content="@{{ seo_author_twitter }}" />
2015-10-25 21:21:46 +00:00
{% endif %}
{% endif %}
2016-02-03 17:52:46 +00:00
{% 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 %}
2016-02-09 23:33:53 +00:00
{% endif %}
2016-02-09 21:22:28 +00:00
{% if site.google_site_verification %}
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
2016-02-03 17:41:05 +00:00
{% endif %}
2016-02-22 18:35:55 +00:00
<script type="application/ld+json">
{
"@context" : "http://schema.org",
{% if page.seo and page.seo.type %}
"@type" : {{ page.seo.type | jsonify }},
{% elsif page.url == "/" %}
"@type" : "WebSite",
{% elsif page.date %}
"@type" : "BlogPosting",
{% else %}
"@type" : "WebPage",
{% endif %}
{% if page.seo and page.seo.name %}
"name" : {{ page.seo.name | jsonify }},
{% elsif page.url == "/" and site.social and site.social.name %}
"name" : {{ site.social.name | jsonify }},
{% elsif page.url == "/" and seo_site_title %}
"name" : {{ seo_site_title | jsonify }},
{% endif %}
{% if seo_page_title %}
"headline": {{ seo_page_title | jsonify }},
{% endif %}
{% if page.image %}
"image": {{ page.image | jsonify }},
{% endif %}
{% if page.date %}
"datePublished": {{ page.date | date_to_xmlschema | jsonify }},
{% endif %}
{% if seo_description %}
"description": {{ seo_description | jsonify }},
2016-02-22 18:35:55 +00:00
{% endif %}
2015-10-25 21:21:46 +00:00
{% if site.logo %}
2016-02-22 18:35:55 +00:00
"logo": {{ site.logo | prepend: "/" | prepend: seo_url | jsonify }},
2015-10-25 21:21:46 +00:00
{% endif %}
2016-02-22 18:35:55 +00:00
{% if page.seo and page.seo.links %}
"sameAs" : {{ page.seo.links | jsonify }},
2016-02-23 02:13:43 +00:00
{% elsif (page.url == "/" or page.url == "/about/") and site.social and site.social.links %}
2016-02-22 18:35:55 +00:00
"sameAs" : {{ site.social.links | jsonify }},
{% endif %}
"url" : "{{ page.url | prepend: seo_url | replace:'/index.html','/' }}"
}
</script>
2015-10-25 21:21:46 +00:00
<!-- End Jekyll SEO tag -->