From 5c65f40bbca27dfb26e75cb027f287b2aa78cd3a Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Tue, 14 Jul 2026 19:38:31 +0200 Subject: Add structured data and microformats This adds JSON-LD for the site, author, blog, and individual blog posts, so search engines and other consumers can understand the blog structure more clearly. It also adds Microformats2 classes to blog posts and the about page, keeping machine-readable author, post, category, date, and content data attached to the visible HTML. --- assets/static/css/style.css | 4 +++ assets/static/images/logo.png | Bin 0 -> 32791 bytes content/about/contents.lr | 2 +- templates/base.html | 38 +++++++++++++++++++++++++ templates/blog-post.html | 53 +++++++++++++++++++++++++++++++++++ templates/blog.html | 7 +++++ templates/includes/blog-json-ld.html | 20 +++++++++++++ templates/index.html | 16 +---------- templates/macros/blog.html | 21 +++++++++----- 9 files changed, 138 insertions(+), 23 deletions(-) create mode 100644 assets/static/images/logo.png create mode 100644 templates/includes/blog-json-ld.html diff --git a/assets/static/css/style.css b/assets/static/css/style.css index ca7443a..f714f3c 100644 --- a/assets/static/css/style.css +++ b/assets/static/css/style.css @@ -278,6 +278,10 @@ SKIP LINK (accessibility) width: 1px; } +.display-none { + display: none !important; +} + /* ============================================================================= SITE HEADER diff --git a/assets/static/images/logo.png b/assets/static/images/logo.png new file mode 100644 index 0000000..a3444ab Binary files /dev/null and b/assets/static/images/logo.png differ diff --git a/content/about/contents.lr b/content/about/contents.lr index 9a65a65..1fd38ad 100644 --- a/content/about/contents.lr +++ b/content/about/contents.lr @@ -10,7 +10,7 @@ body: Hi, I'm Dennis. Welcome!

-![](me.jpg "class='center w33 round'") +![](me.jpg "class='center w33 round u-photo'") I am originally from Luxembourg and grew up in the south of the country. During my formative years, I spent a lot of time in a local scouts group, which was a diff --git a/templates/base.html b/templates/base.html index e2c145f..024907d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -26,6 +26,44 @@ content="Muted green Hilbert-curve logo beside the words “Still Thinking About It” on a dark blue background"> {% endblock meta %} + {% block json_ld %} + + {% endblock %} {% block styles %} {% 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 %} + + + {% endif %} +{% endblock %} + {% block styles %} {{ super() }} {% endblock %} + {% block content %}{{ render_blog_post(this) }}{% endblock %} diff --git a/templates/blog.html b/templates/blog.html index 0ee96c7..4c011a1 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -6,10 +6,17 @@ {{ super() }} {% endblock %} + +{% block json_ld %} + {{ super() }} + {% include "includes/blog-json-ld.html" %} +{% endblock json_ld %} + {% block styles %} {{ super() }} {% endblock %} + {% block content %}{{ render_blog_index(this.pagination) }}{% endblock %} diff --git a/templates/includes/blog-json-ld.html b/templates/includes/blog-json-ld.html new file mode 100644 index 0000000..63d3c66 --- /dev/null +++ b/templates/includes/blog-json-ld.html @@ -0,0 +1,20 @@ + diff --git a/templates/index.html b/templates/index.html index 0ee96c7..396114f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,15 +1 @@ -{% extends "base.html" %} - -{% from "macros/blog.html" import render_blog_index %} - -{% block meta %} - {{ super() }} - -{% endblock %} -{% block styles %} - {{ super() }} - -{% endblock %} -{% block content %}{{ render_blog_index(this.pagination) }}{% endblock %} +{% include "blog.html" %} diff --git a/templates/macros/blog.html b/templates/macros/blog.html index b4caafe..904e59e 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -19,11 +19,11 @@ {% endmacro %} {% macro render_blog_post(post, show_toc=True) %} -
+

- {{ post.title }} + {{ post.title }}

{% if post.publication_date %} @@ -31,7 +31,8 @@
Posted:
- +
@@ -47,7 +48,8 @@
Last updated:
- +
{% endif %} @@ -56,10 +58,13 @@
Category:
{% set category = site.get('/categories/'+post.category) %} - {{ category.name }} + {{ category.name }}
{% endif %} + {% if show_toc and post.render_toc %} @@ -67,7 +72,7 @@ {{ render_toc(toc) }} {% endif %}
- {{ post.body }} +
{{ post.body }}
{% if post.tags %}