jekyll-seo-tag/lib/template.html

157 lines
5.0 KiB
HTML
Raw Normal View History

2015-10-25 21:21:46 +00:00
<!-- Begin Jekyll SEO tag -->
{% if site.url %}
2016-01-06 18:00:20 +00:00
{% assign seo_url = site.url | append: site.baseurl %}
2015-10-25 21:21:46 +00:00
{% elsif site.github.url %}
{% assign seo_url = site.github.url %}
{% endif %}
{% if site.title %}
{% assign seo_site_title = site.title %}
{% elsif site.name %}
{% assign seo_site_title = site.name %}
{% endif %}
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 %}
{% 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-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 %}
{% 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 %}
{% if seo_site_title %}
{% assign seo_site_title = seo_site_title | markdownify | strip_html | strip_newlines | escape_once %}
{% endif %}
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
{% if page.description %}
{% assign seo_description = page.description %}
{% elsif page.excerpt %}
{% assign seo_description = page.excerpt %}
2015-10-25 21:21:46 +00:00
{% elsif site.description %}
{% assign seo_description = site.description %}
{% endif %}
{% 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-01-12 20:09:43 +00:00
{% if page.author %}
{% if page.author.name %}
{% assign seo_author_name = page.author.name %}
{% else %}
{% assign seo_author_name = page.author %}
{% endif %}
{% if page.author.twitter %}
{% assign seo_author_twitter = page.author.twitter %}
{% else %}
{% assign seo_author_twitter = page.author %}
{% endif %}
{% endif %}
{% if seo_author_twitter %}
{% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" %}
{% endif %}
2015-10-25 21:21:46 +00:00
{% if seo_title %}
<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 %}
2016-01-06 17:52:26 +00:00
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" itemprop="url" />
<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
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : {{ seo_site_title | jsonify }},
2015-10-25 21:21:46 +00:00
"url" : {{ seo_url | jsonify }}
}
</script>
{% endif %}
{% if page.image %}
<meta property="og:image" content="{{ page.image }}" />
{% endif %}
{% if page.date %}
<meta property="og:type" content="article" />
{% 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 %}
{% 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 %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": {{ page.title | jsonify }},
"image": {{ page.image | jsonify }},
"datePublished": {{ page.date | date_to_xmlschema | jsonify }},
"description": {{ page.description | jsonify }}
}
</script>
{% 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 }}" />
{% if page.image %}
<meta name="twitter:image" content="{{ page.image | escape }}" />
{% endif %}
2016-01-12 20:09:43 +00:00
{% if seo_author_twitter %}
<meta name="twitter:creator" content="{{ seo_author_twitter }}" />
2015-10-25 21:21:46 +00:00
{% 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 %}{{ seo_site_title }}{% endif %}",
2015-10-25 21:21:46 +00:00
"url" : {{ seo_url | jsonify }},
"sameAs" : {{ site.social.links | jsonify }}
}
</script>
{% endif %}
<!-- End Jekyll SEO tag -->