Added meta tags to posts

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
Jim Martens 2018-03-16 10:15:33 +01:00
parent 5a2b8cfc48
commit 5d1d008a0f
2 changed files with 29 additions and 0 deletions

View File

@ -6,6 +6,29 @@
<meta name="description"
content='{% if page.excerpt %}{{ page.excerpt | strip_html | strip | truncatewords: 75 }}{% elsif page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}'>
<meta property="og:site_name" content="{{ site.title }}">
{% if page.title %}
<meta property="og:title" content="{{ page.title }}">
<meta property="og:type" content="article">
<meta property="og:description" content="{{ page.excerpt | strip_html }}"/>
{% else %}
<meta property="og:title" content="{{ site.title }}">
<meta property="og:type" content="website">
<meta property="og:description" content="{{ site.description }}">
{% endif %}
{% if page.date %}
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
{% endif %}
<meta property="og:url" content="{{ site.url }}{{ page.url }}" />
{% if page.tags %}
<meta itemprop="keywords" content="{{ page.tags | join: ',' }}" />
{% for tag in page.tags %}
<meta property="article:tag" content="{{ tag }}">
{% endfor %}
{% endif %}
{% if author %}
<meta property="article:author" content="{{ author.name }}" />
{% endif %}
{% asset main.css %}
{% asset fa-svg-with-js.css %}
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">

View File

@ -1,6 +1,11 @@
---
layout: default
---
{% if page.date_modified %}
{% assign modified = page.date_modified %}
{% else %}
{% assign modified = page.date %}
{% endif %}
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
@ -10,6 +15,7 @@ layout: default
<time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
{{ page.date | date: "%b %-d, %Y" }}
</time>
<meta content="{{ modified | date_to_xmlschema }}" itemprop="dateModified" />
{% if page.author %} • <span class="far fa-user"></span>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">{{ page.author }}</span>