summaryrefslogtreecommitdiff
path: root/templates/blog-post.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/blog-post.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/templates/blog-post.html b/templates/blog-post.html
index 0844351..f5e8bbe 100644
--- a/templates/blog-post.html
+++ b/templates/blog-post.html
@@ -22,10 +22,63 @@
<meta property="article:tag" content="{{ t }}">
{% endfor %}
{% endblock %}
+
+{% block json_ld %}
+ {{ super() }}
+ {% include "includes/blog-json-ld.html" %}
+ {% if this.publication_date %}
+ {% set post_url = this | url(absolute=True, external=True) %}
+ {% set post_id = post_url ~ '#blogposting' %}
+ {% set person_url = '/about' | url(absolute=True, external=True) %}
+ {% set person_id = person_url ~ '#person' %}
+ {% set blog_url = '/blog' | url(absolute=True, external=True) %}
+ {% set blog_id = blog_url ~ '#blog' %}
+ {% set modified_date = this.publication_date %}
+ {% if this.updated_date %}
+ {% set modified_date = this.updated_date %}
+ {% endif %}
+ {% set post_description = bag('blog.tagline') %}
+ {% if this.description %}
+ {% set post_description = this.description %}
+ {% endif %}
+ {% if this.category %}
+ {% set category = site.get("/categories/" + this.category).name %}
+ {% endif %}
+
+ <script type="application/ld+json">
+ {
+ "@context": "https://schema.org",
+ "@type": "BlogPosting",
+ "@id": "{{ post_id }}",
+ "mainEntityOfPage": "{{ post_url }}",
+ "url": "{{ post_url }}",
+ "isPartOf": {
+ "@id": "{{ blog_id }}"
+ },
+ "headline": "{{ this.title }}",
+ "name": "{{ this.title }}",
+ "description": "{{ post_description }}",
+ "datePublished": "{{ this.publication_date | dateformat('yyyy-MM-dd') }}T00:00:00Z",
+ "dateModified": "{{ modified_date | dateformat('yyyy-MM-dd') }}T00:00:00Z",
+ "inLanguage": "en",
+ "author": {
+ "@id": "{{ person_id }}"
+ },
+ "publisher": {
+ "@id": "{{ person_id }}"
+ },
+ "keywords": "{{ this.tags | join(', ') }}",
+ "articleSection": "{{ category }}"
+ }
+ </script>
+ {% endif %}
+{% endblock %}
+
{% block styles %}
{{ super() }}
<link rel="stylesheet"
type="text/css"
href="{{ '/static/css/blog.css'|asseturl }}">
{% endblock %}
+
{% block content %}{{ render_blog_post(this) }}{% endblock %}