summaryrefslogtreecommitdiff
path: root/templates/sitemap.xml
diff options
context:
space:
mode:
authorDennis Fink2026-11-04 19:08:41 +0100
committerDennis Fink2026-11-04 19:08:41 +0100
commitf284b9ad986a33e4121eb40a0fb3106ac052a984 (patch)
tree5583d726840a0b1e293e751d840a211b8a3a7d11 /templates/sitemap.xml
parent99fe96443fe38685dc7d01f38cf7db9ce2ae5f79 (diff)
downloaddennisfink.me-f284b9ad986a33e4121eb40a0fb3106ac052a984.tar.gz
dennisfink.me-f284b9ad986a33e4121eb40a0fb3106ac052a984.zip
Add XML sitemap generation
This adds a sitemap template that recursively lists site pages and their URLs, with child pages sorted by path for consistent output. It also registers `/sitemap.xml` as a non-discoverable Lektor page and advertises the sitemap in the site's document head.
Diffstat (limited to 'templates/sitemap.xml')
-rw-r--r--templates/sitemap.xml7
1 files changed, 7 insertions, 0 deletions
diff --git a/templates/sitemap.xml b/templates/sitemap.xml
new file mode 100644
index 0000000..04d2a42
--- /dev/null
+++ b/templates/sitemap.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+ {%- for page in [site.root] if page != this recursive %}
+ <url><loc>{{ page|url(external=true) }}</loc></url>
+ {{- loop(page.children|sort(attribute='path')) }}
+ {%- endfor %}
+</urlset>