Files
max-sixty__worktrunk/docs/templates/sitemap.xml
Maximilian Roos 56d7bb825d fix(docs): exclude alternate pages from sitemap and add trailing slashes to nav (#2320)
Search Console flagged two indexing issues on worktrunk.dev:

**"Alternate page with proper canonical tag"**: the sitemap listed
`/worktrunk/`, which canonicalizes to `/` (its content is rendered on
the homepage via `templates/index.html`). Only canonicals belong in a
sitemap. Skip sitemap entries whose frontmatter declares a canonical.

**"Page with redirect"**: the `extra_menu` links `/worktrunk` and
`/tips-patterns` had no trailing slash, so every page's nav triggered a
301 on GitHub Pages. Added the trailing slashes.

Verified locally with `zola build`: sitemap goes from 14 to 13 entries
(no more `/worktrunk/`), `/worktrunk/` page still served with canonical
= `/`, and built nav hrefs now have trailing slashes.

Search Console also reported "Not found (404)" — those are old renamed
URLs (`/why-worktrunk/`, `/quickstart/`, `/advanced/`) that no longer
exist. Left alone here: a static 404 is correct, and adding meta-refresh
redirect stubs would just create new "Page with redirect" entries.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-19 22:38:15 -07:00

17 lines
564 B
XML

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for sitemap_entry in entries %}
{#- Skip pages that declare a non-self canonical — only canonical URLs belong in the sitemap. #}
{%- if not sitemap_entry.extra.canonical %}
<url>
<loc>{{ sitemap_entry.permalink | escape_xml | safe }}</loc>
{%- if sitemap_entry.updated %}
<lastmod>{{ sitemap_entry.updated }}</lastmod>
{%- else %}
<lastmod>{{ now() | date(format="%Y-%m-%d") }}</lastmod>
{%- endif %}
</url>
{%- endif %}
{%- endfor %}
</urlset>