summaryrefslogtreecommitdiff
path: root/templates/blog-post.html
blob: a8eaf37c716693bf9d956f836a474d55a29611ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{% extends "base.html" %}

{% from "macros/blog.html" import render_blog_post %}

{% set pagefind_body = true %}

{% set features = namespace(trail=false) %}

{% for block in this.body.blocks %}
  {% if block._flowblock == "trail" %}
    {% set features.trail = true %}
  {% endif %}
{% endfor %}

{% set needs_trail_assets = features.trail %}
{% set latest_change = this.changelog.blocks | max(attribute="date") if this.changelog else none %}

{% block meta %}
  {{ super() }}
  <meta property="og:type" content="article">
  <meta property="article:author" content="https://dennisfink.me/about">
  {% if this.publication_date %}
    <meta property="article:published_time"
          content="{{ this.publication_date }}T00:00:00+02:00">
  {% endif %}
  {% if latest_change %}
    <meta property="article:modified_time"
          content="{{ latest_change.date }}T00:00:00+02:00">
  {% endif %}
  {% if this.category %}
    {% set category = site.get("/categories/" + this.category) %}
    <meta property="article:section" content="{{ category.name }}">
  {% endif %}
  {% for t in this.tags %}
    <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 latest_change %}
      {% set modified_date = latest_change.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 %}