summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDennis Fink2026-11-04 18:41:23 +0100
committerDennis Fink2026-11-04 18:41:23 +0100
commite7e365c239f766a8d2271c233f16c4df53a9bbb3 (patch)
tree3fe4b543aee8f16fb42204d666ca2a17a268c1ac /templates
parent7b234437e57f75befdec8eaa177bb541654c72a5 (diff)
downloaddennisfink.me-e7e365c239f766a8d2271c233f16c4df53a9bbb3.tar.gz
dennisfink.me-e7e365c239f766a8d2271c233f16c4df53a9bbb3.zip
Improve Pagefind indexing and filtering
This adds publication dates, categories, and tags to Pagefind metadata, enabling search results to be sorted by date and filtered by category or tag. It also excludes tables of contents, post metadata, and footer sections from search indexing to keep results focused on the actual article content.
Diffstat (limited to 'templates')
-rw-r--r--templates/blog-post.html12
-rw-r--r--templates/macros/blog.html12
2 files changed, 16 insertions, 8 deletions
diff --git a/templates/blog-post.html b/templates/blog-post.html
index 3bde48d..4f1e5a2 100644
--- a/templates/blog-post.html
+++ b/templates/blog-post.html
@@ -21,7 +21,9 @@
<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">
+ content="{{ this.publication_date }}T00:00:00+02:00"
+ data-pagefind-meta="date[content]"
+ data-pagefind-sort="date[content]">
{% endif %}
{% if latest_change %}
<meta property="article:modified_time"
@@ -29,10 +31,14 @@
{% endif %}
{% if this.category %}
{% set category = site.get("/categories/" + this.category) %}
- <meta property="article:section" content="{{ category.name }}">
+ <meta property="article:section"
+ content="{{ category.name }}"
+ data-pagefind-filter="category[content]">
{% endif %}
{% for t in this.tags %}
- <meta property="article:tag" content="{{ t }}">
+ <meta property="article:tag"
+ content="{{ t }}"
+ data-pagefind-filter="tag[content]">
{% endfor %}
{% endblock %}
diff --git a/templates/macros/blog.html b/templates/macros/blog.html
index c3b5390..09e6a65 100644
--- a/templates/macros/blog.html
+++ b/templates/macros/blog.html
@@ -1,7 +1,7 @@
{% from "macros/pagination.html" import render_pagination %}
{% macro render_toc(toc, maxdepth=2) %}
- <nav aria-label="Table of contents">
+ <nav aria-label="Table of contents" data-pagefind-ignore>
<p>Table of contents</p>
<ol>
{% for item in toc recursive %}
@@ -37,7 +37,7 @@
<h2>
<a href="{{ post|url }}" class="u-url p-name">{{ post.title }}</a>
</h2>
- <dl>
+ <dl data-pagefind-ignore>
{% if post.publication_date %}
<div>
<dt>Posted:</dt>
@@ -86,7 +86,7 @@
<div class="e-content">{{ post.body }}</div>
<footer>
{% if post.tags %}
- <section>
+ <section data-pagefind-ignore>
<ul aria-label="Tags">
<li>Tagged with</li>
{% for tag in post.tags %}
@@ -101,12 +101,14 @@
</ul>
</section>
{% endif %}
- <section>
+ <section data-pagefind-ignore>
<p>Reply to this post by <a rel="nofollow"
href="&#x6D;&#x61;&#x69;&#x6C;&#x74;&#x6F;&#x3A;&#x6D;&#x65;&#x2B;&#x62;&#x6C;&#x6F;&#x67;&#x40;&#x64;&#x65;&#x6E;&#x6E;&#x69;&#x73;&#x66;&#x69;&#x6E;&#x6B;&#x2E;&#x6D;&#x65;&#x3F;&#x73;&#x75;&#x62;&#x6A;&#x65;&#x63;&#x74;&#x3D;&#x52;&#x45;&#x3A;&#x20;{{ post.title }}">email</a>.</p>
</section>
{% if post.changelog %}
- <section class="changelog" aria-labelledby="changelog-heading">
+ <section class="changelog"
+ aria-labelledby="changelog-heading"
+ data-pagefind-ignore>
<h3 id="changelog-heading">Changelog</h3>
<ul>
{% for entry in post.changelog.blocks %}