summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-06-19 18:35:56 +0200
committerDennis Fink2026-06-19 18:35:56 +0200
commitcc6003d997e041127ac081e14a3213c4b898860d (patch)
treee08ae35574e8465994953bdc3126039ecce21516
parent41e364a3278ebe673cc851a80c206885076ed569 (diff)
downloaddennisfink.me-cc6003d997e041127ac081e14a3213c4b898860d.tar.gz
dennisfink.me-cc6003d997e041127ac081e14a3213c4b898860d.zip
Add page descriptions for metadata previews
This adds a description field to blog posts and uses it for the HTML meta description and Open Graph description, with the blog tagline remaining as the fallback. Archive, category, and tag pages now define their own descriptions so previews are more specific instead of all sharing the same generic site tagline.
Diffstat (limited to '')
-rw-r--r--content/blog/back-to-blogging/contents.lr2
-rw-r--r--models/blog-post.ini15
-rw-r--r--templates/base.html5
-rw-r--r--templates/blog-month-index.html4
-rw-r--r--templates/blog-year-index.html1
-rw-r--r--templates/categories.html1
-rw-r--r--templates/category.html1
-rw-r--r--templates/tag.html3
8 files changed, 25 insertions, 7 deletions
diff --git a/content/blog/back-to-blogging/contents.lr b/content/blog/back-to-blogging/contents.lr
index a68236a..2673a0c 100644
--- a/content/blog/back-to-blogging/contents.lr
+++ b/content/blog/back-to-blogging/contents.lr
@@ -41,3 +41,5 @@ human-written web
atom feed
---
category: site-notes
+---
+description: A short note on returning to blogging, digital independence, and the value of human-written spaces on the web.
diff --git a/models/blog-post.ini b/models/blog-post.ini
index 4f36c1e..dec758a 100644
--- a/models/blog-post.ini
+++ b/models/blog-post.ini
@@ -23,6 +23,17 @@ type = select
source = site.query('/categories')
width = 1/2
+[fields.tags]
+label = Tags
+type = strings
+width = 1/2
+
+[fields.description]
+label = Description
+type = string
+description = Short summary used for the HTML meta description and Open Graph previews.
+width = 1/2
+
[fields.render_toc]
label = Render TOC
type = boolean
@@ -34,6 +45,4 @@ width = 1/2
label = Body
type = markdown
-[fields.tags]
-label = Tags
-type = strings
+
diff --git a/templates/base.html b/templates/base.html
index 12e9803..0cec0b4 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -8,8 +8,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark light">
<meta name="generator" content="lektor">
- <meta name="description" content="{{ bag('blog.tagline') }}">
- <meta property="og:description" content="{{ bag('blog.tagline') }}">
+ {% set page_description = description|default(this.description|default(bag('blog.tagline'), true), true) %}
+ <meta name="description" content="{{ page_description }}">
+ <meta property="og:description" content="{{ page_description }}">
<meta property="og:site_name" content="{{ bag('blog.name') }}">
<meta property="og:title"
content="{% if (this.title or title) %}{{ (this.title or title) | safe }}{% else %}{{ bag('blog.name') }}{% endif %}">
diff --git a/templates/blog-month-index.html b/templates/blog-month-index.html
index d114628..96c5f93 100644
--- a/templates/blog-month-index.html
+++ b/templates/blog-month-index.html
@@ -12,7 +12,9 @@
type="text/css"
href="{{ '/static/css/category.css'|asseturl }}">
{% endblock %}
-{% set title = "Monthly archive: " + this.date | dateformat('MMMM y') %}
+{% set month_name = this.date | dateformat("MMMM y") %}
+{% set title = "Monthly archive: " + month_name %}
+{% set description = "Browse posts from " + month_name + " on Still Thinking About It." %}
{% block content %}
{% set post_count = this.children.count() %}
<article>
diff --git a/templates/blog-year-index.html b/templates/blog-year-index.html
index 138cc86..b7044ac 100644
--- a/templates/blog-year-index.html
+++ b/templates/blog-year-index.html
@@ -13,6 +13,7 @@
href="{{ '/static/css/category.css'|asseturl }}">
{% endblock %}
{% set title = "Yearly archive: " + this.key %}
+{% set description = "Browse posts from " + this.key + " on Still Thinking About It." %}
{% block content %}
{% set post_count = this.children.count() %}
<article>
diff --git a/templates/categories.html b/templates/categories.html
index 4dbdf1a..bc124f8 100644
--- a/templates/categories.html
+++ b/templates/categories.html
@@ -11,6 +11,7 @@
href="{{ '/static/css/categories.css'|asseturl }}">
{% endblock %}
{% set title = "Categories" %}
+{% set description = "Browse the main themes and categories of posts on Still Thinking About It." %}
{% block content %}
<article>
<header>
diff --git a/templates/category.html b/templates/category.html
index 9d6b35d..fcd63eb 100644
--- a/templates/category.html
+++ b/templates/category.html
@@ -11,6 +11,7 @@
href="{{ '/static/css/category.css'|asseturl }}">
{% endblock %}
{% set title = "Category " + this.name %}
+{% set description = "Posts in the category “" + this.name + "” on Still Thinking About It." %}
{% block content %}
{% set post_count = this.children.count() %}
<article>
diff --git a/templates/tag.html b/templates/tag.html
index b433616..b3642bc 100644
--- a/templates/tag.html
+++ b/templates/tag.html
@@ -10,7 +10,8 @@
type="text/css"
href="{{ '/static/css/category.css'|asseturl }}">
{% endblock %}
-{% set title = "Tag " + this.tag %}
+{% set title = "Tag: " + this.tag %}
+{% set description = "Posts tagged with “" + this.tag + "” on Still Thinking About It." %}
{% block content %}
{% set post_count = this.items.count() %}
<article>