summaryrefslogtreecommitdiff
path: root/templates/macros/blog.html
diff options
context:
space:
mode:
authorDennis Fink2026-07-14 19:38:31 +0200
committerDennis Fink2026-07-14 19:38:31 +0200
commit5c65f40bbca27dfb26e75cb027f287b2aa78cd3a (patch)
treeb21a1d58ee9efde63f7a5a1f7545b2c6bd03a4ef /templates/macros/blog.html
parent206400382a5c111842fd77c8418ad94a85f2da99 (diff)
downloaddennisfink.me-5c65f40bbca27dfb26e75cb027f287b2aa78cd3a.tar.gz
dennisfink.me-5c65f40bbca27dfb26e75cb027f287b2aa78cd3a.zip
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.
Diffstat (limited to '')
-rw-r--r--templates/macros/blog.html21
1 files changed, 14 insertions, 7 deletions
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) %}
- <article>
+ <article class="h-entry">
<header>
<div>
<h2>
- <a href="{{ post|url }}">{{ post.title }}</a>
+ <a href="{{ post|url }}" class="u-url p-name">{{ post.title }}</a>
</h2>
<dl>
{% if post.publication_date %}
@@ -31,7 +31,8 @@
<dt>Posted:</dt>
<dd>
<a href="{{ ('/blog@index-pages/year/{}'.format(post.publication_date.year) ) | url }}">
- <time datetime="{{ post.publication_date | dateformat('yyyy-MM-dd') }}">{{ post.publication_date | dateformat("d MMMM yyyy") }}</time>
+ <time datetime="{{ post.publication_date | dateformat('yyyy-MM-dd') }}"
+ class="dt-published">{{ post.publication_date | dateformat("d MMMM yyyy") }}</time>
</a>
</dd>
</div>
@@ -47,7 +48,8 @@
<div>
<dt>Last updated:</dt>
<dd>
- <time datetime="{{ post.updated_date | dateformat('yyyy-MM-dd') }}">{{ post.updated_date | dateformat("d MMMM yyyy") }}</time>
+ <time datetime="{{ post.updated_date | dateformat('yyyy-MM-dd') }}"
+ class="dt-updated">{{ post.updated_date | dateformat("d MMMM yyyy") }}</time>
</dd>
</div>
{% endif %}
@@ -56,10 +58,13 @@
<dt>Category:</dt>
<dd>
{% set category = site.get('/categories/'+post.category) %}
- <a href="{{ category|url }}">{{ category.name }}</a>
+ <a href="{{ category|url }}" class="p-category">{{ category.name }}</a>
</dd>
</div>
{% endif %}
+ <a rel="author"
+ class="p-author h-card display-none"
+ href="{{ '/about' | url(absolute=True) }}">Dennis Fink</a>
</dl>
</div>
{% if show_toc and post.render_toc %}
@@ -67,7 +72,7 @@
{{ render_toc(toc) }}
{% endif %}
</header>
- {{ post.body }}
+ <div class="e-content">{{ post.body }}</div>
{% if post.tags %}
<footer>
<p>Tagged with</p>
@@ -75,7 +80,9 @@
{% for tag in post.tags %}
<li>
{% set tag_slug = tag|trim|lower|replace(" ", "-") %}
- <a href="{{ ('/blog/tag/' ~ tag_slug ~ '/')|url }}" rel="tag">{{ tag }}</a>
+ <a href="{{ ('/blog/tag/' ~ tag_slug ~ '/')|url }}"
+ rel="tag"
+ class="p-category">{{ tag }}</a>
{%- if not loop.last -%}, {%- else -%}.{%- endif -%}
</li>
{% endfor %}