Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

fix(seo): generate sitemap.xml at deploy, not in git (#1811)

Ömer Taha Öztop4f07386eaa21
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
index da8f9e122..cc200e056 100644
--- a/.github/workflows/deploy-pages.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -1,10 +1,12 @@
name: Deploy site (Cloudflare Pages)
# Deploys the static site under landing/ to the "xerj" Cloudflare Pages project
-# on every push to main. Cloudflare serves landing/ verbatim (no build step);
-# wrangler uploads it directly. Auth is a scoped API token stored as the
-# CLOUDFLARE_API_TOKEN repo secret (needs the "Cloudflare Pages:Edit" permission)
-# plus CLOUDFLARE_ACCOUNT_ID. Both are configured in repo Settings → Secrets.
+# on every push to main. Cloudflare serves landing/ verbatim; the only build
+# step is `gen_sitemap.py --write`, which writes sitemap.xml into landing/ just
+# before the upload because that file is not kept in git. Auth is a scoped API
+# token stored as the CLOUDFLARE_API_TOKEN repo secret (needs the "Cloudflare
+# Pages:Edit" permission) plus CLOUDFLARE_ACCOUNT_ID. Both are configured in
+# repo Settings → Secrets.
#
# This replaces reliance on Cloudflare's git integration with an explicit,
# auditable deploy that only fires after CI/SEO gates on main have the chance to
@@ -16,6 +18,10 @@ on:
paths:
- 'landing/**'
- 'wrangler.toml'
+ # sitemap.xml is generated here, and its <lastmod> comes from
+ # urlmap.article_data/pagedata dates, so any change under scripts/seo/
+ # can change the shipped artifact with no landing/ edit.
+ - 'scripts/seo/**'
- '.github/workflows/deploy-pages.yml'
workflow_dispatch: {} # allow manual redeploy from the Actions tab
@@ -42,6 +48,13 @@ jobs:
steps:
- name: Check out the site
uses: actions/checkout@v4
+ with:
+ # sitemap.xml is generated below from `urlmap.DateSource`, which
+ # dates a page from its content (front matter, JSON-LD, a
+ # chrome-stripped git commit). A shallow clone has none of that
+ # history, so undated URLs would ship the filesystem mtime — the one
+ # value Google only honours when it is verifiably accurate.
+ fetch-depth: 0
- name: Guard — secrets must be present
run: |
@@ -51,6 +64,16 @@ jobs:
fi
[ -d landing ] || { echo "::error::landing/ not found — nothing to deploy."; exit 1; }
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+
+ # sitemap.xml is a deploy artifact, not a committed file, so there is
+ # nothing here to forget to regenerate: it is written into landing/ just
+ # before the upload and ships with the rest of the site.
+ - name: Generate the sitemap
+ run: python3 scripts/seo/gen_sitemap.py --write
+
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
diff --git a/.github/workflows/seo.yml b/.github/workflows/seo.yml
index 2e9802c4e..b8e58090d 100644
--- a/.github/workflows/seo.yml
+++ b/.github/workflows/seo.yml
@@ -47,8 +47,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
- # <lastmod> comes from `git log -1 --format=%cs -- <file>`; a shallow
- # clone would silently degrade every date to the filesystem mtime.
+ # <lastmod> comes from `git log --date=format-local` with TZ=UTC
+ # (`urlmap.DateSource`); a shallow clone would make every file look
+ # added at the boundary and silently degrade every date to mtime.
fetch-depth: 0
- uses: actions/setup-python@v5
@@ -74,6 +75,12 @@ jobs:
- name: Agent-discovery delivery regressions
run: python3 scripts/seo/test_verify_agent_discovery.py
+ # The audit's <lastmod> must be the generator's date, or a freshly built
+ # sitemap reports itself stale; this also exercises the in-memory build
+ # used when landing/sitemap.xml (a deploy artifact) is absent.
+ - name: Audit date unit tests
+ run: python3 scripts/seo/test_audit_dates.py
+
# The field report has its own section, ahead of Optional, and the
# homepage prompt asks before sending.
- name: Field-report section and permission line
@@ -82,7 +89,12 @@ jobs:
- name: generated articles are current
run: python3 scripts/seo/build_articles.py --check
- - name: sitemap.xml is generated, not hand-edited
+ # sitemap.xml is a deploy artifact: `Deploy site (Cloudflare Pages)` runs
+ # `gen_sitemap.py --write` on a full checkout before uploading landing/,
+ # and no copy is committed. The tools that inspect it (`seo_lint.py`,
+ # `audit.py`, `verify_live.py`) build it from the tree when the file is
+ # absent, so this step is the gate on the derivation itself.
+ - name: sitemap derivation is valid
run: python3 scripts/seo/gen_sitemap.py --check
- name: every <head> matches the generator
diff --git a/.gitignore b/.gitignore
index 3ba803f3b..e90c915c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -188,6 +188,13 @@ __pycache__/
# would silently drop this file and nothing would say so.
!scripts/seo/README.md
+# sitemap.xml is a deploy artifact, not a source file: `Deploy site (Cloudflare
+# Pages)` runs `gen_sitemap.py --write` on a full checkout and uploads it with
+# the rest of landing/. Keeping it in git meant every landing edit that forgot
+# to re-run the generator turned main red and added a two-line <lastmod>
+# conflict to the PR. Run the generator locally to inspect it; do not commit it.
+landing/sitemap.xml
+
# Working record for agent sessions. Never committed: the captures and
# research notes under .dogfood/ are the session's scratch record, not
# repository material, and the blanket *.md rule above does not cover
diff --git a/AGENTS.md b/AGENTS.md
index 31634add9..8a297b041 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -253,9 +253,11 @@ ships. Four rules keep a merge gate green:
- **Do not hand-edit generated HTML.** `landing/answers/**`, `landing/compare/**`
and their `.md` twins are rendered from `content/answers/*.md` and
- `content/compare/*.md` by `scripts/seo/build_articles.py`; `sitemap.xml` is
- derived from the filesystem and from `git log`. Every generated file says so on
- its first line. Edit the source, run the generator, commit the output.
+ `content/compare/*.md` by `scripts/seo/build_articles.py`. Every generated file
+ says so on its first line. Edit the source, run the generator, commit the
+ output. `sitemap.xml` is derived the same way but is **not** committed: it is
+ a deploy artifact (`deploy-pages.yml` writes it before the upload, and it is
+ gitignored), so there is nothing to run or commit for it.
- **Never write a `.html` internal link.** Pages serves this site
extensionless — `/product.html` 308s to `/product`. `scripts/seo/urlmap.py` is
the single source of truth, and canonical, `og:url` and the sitemap `<loc>`
diff --git a/landing/sitemap.xml b/landing/sitemap.xml
deleted file mode 100644
index 96a124937..000000000
--- a/landing/sitemap.xml
+++ /dev/null
@@ -1,823 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
- <url>
- <loc>https://xerj.org/</loc>
- <lastmod>2026-10-27</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/agent-search/</loc>
- <lastmod>2026-10-22</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/aise-demo</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/agent-memory-without-postgres-qdrant</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/answer-questions-about-a-docs-folder-with-citations</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/ask-questions-about-a-github-repo-without-cloning</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/audit-php-codebase-with-an-index</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/autoindex-dataset-refused-by-server</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/autoindex-exit-codes</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/autoindex-says-extract-the-archive-first</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/autoindex-server-back-pressure-429</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/batch-lookup-cve-ghsa-ids-offline</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/batch-lookup-ids-from-csv-against-local-index</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/catalog-files-with-autoindex-map</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/cheap-low-volume-log-search</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/check-codebase-index-is-complete</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/classify-text-from-labelled-history-without-llm</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/code-search-mcp-for-claude-code</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/coding-agent-memory-across-sessions</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/count-keyword-mentions-over-time-jsonl</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/do-search-embeddings-help</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/does-xerj-support-s3-alerting-plugins</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/estimate-autoindex-time-before-running</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/evidence-for-agent-memory-links</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/filter-knn-exact-scan-caveat</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/find-duplicate-github-issues-before-filing</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/full-text-search-browser-history</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/full-text-search-over-jsonl-files-cli</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/full-text-search-sqlite-database</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/give-chatgpt-claude-local-file-access</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/how-xerj-autoindexes-a-folder</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/how-xerj-combines-search</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/hybrid-search-quality-measured-ndcg</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/improve-basic-faiss-rag-pipeline</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/index-csv-with-many-columns</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/index-markdown-into-elasticsearch-api</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/index-monorepo-for-agent</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/index-multiple-csv-files</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/index-reference-library-for-coding-agent</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/is-pdf-indexing-efficient</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/keep-index-current-as-files-change</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/keep-s3-bucket-index-current</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/knowledge-graphs-for-agent-memory</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/local-code-search-mcp-fewer-tokens-than-grep</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/local-embeddings-without-openai-api</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/local-search-mcp-for-codex-and-cursor</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/mcp-api-search-or-vector-search</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/notion-export-duplicate-search-results</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/private-agent-memory-namespaces</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/rag-without-vector-database</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/read-autoindex-progress</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/read-indexed-email-and-pdf-folder</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/rebuild-reference-corpus-index</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/reciprocal-rank-fusion-when-to-use</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/reduce-embedding-api-cost</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/reindex-taking-forever</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/rerank-search-results-calibrated-judge</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/resume-interrupted-autoindex-run</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/retrieval-that-says-not-found-with-file-line-citations</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-all-pdfs-in-a-folder</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-bvh-motion-capture-files</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-claude-code-past-sessions</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-confluence-html-export</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-engine-without-docker</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-file-contents-in-a-folder</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-files-in-an-s3-bucket</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-github-issues-and-prs-locally</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-gmail-takeout-mbox-locally</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-gzip-logs-without-zgrep</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-gzipped-csv-or-json</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-html-export</loc>
- <lastmod>2026-08-21</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-json-and-jsonl-logs</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-jupyter-notebook-cells</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-kubernetes-pod-logs-on-disk</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-obsidian-pdf-docx-attachments</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-openapi-spec-for-agent</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-slack-json-export</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-sql-dump-file</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-unity-project-assets</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-word-documents-in-a-folder</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-yaml-xml-config-repository</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/search-zendesk-ticket-json-export</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/set-mcp-memory-storage-path</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/share-folder-read-only-search-without-uploading</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/share-local-search-index-through-a-tunnel</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/store-agent-memory-without-llm-call</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/syntax-aware-code-search-refactoring</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/vector-database-vs-full-text-search</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/verify-ai-report-claims-against-sources</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/what-a-share-link-guest-can-reach</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/what-is-xerj</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/answers/why-autoindex-skipped-files</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/architecture/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/benchmarks/</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/benchmarks/elasticsearch</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/</loc>
- <lastmod>2026-10-26</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/autoindex-search-performance-improvements</loc>
- <lastmod>2026-10-26</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/corpus-hub-v2</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/cutting-the-index-28-percent</loc>
- <lastmod>2026-09-27</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/does-xerj-beat-jev</loc>
- <lastmod>2026-09-27</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/eval-scars-from-agent-memory</loc>
- <lastmod>2026-10-11</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/jev-vs-a-bm25-vote</loc>
- <lastmod>2026-09-27</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/one-vulnerability-three-names</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/rc99-smart-autoindex-harness-tools</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/the-corpus-hub</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/the-exploit-hub</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/blog/the-rc80-gates</loc>
- <lastmod>2026-09-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/brand</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies/calltree-analytics</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies/daily-dev-postgres-cdc</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies/reference-coding</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies/wordpress-security-audit</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/case-studies/xerj-self-audit</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/best-grep-alternative-for-ai-coding-agents-2026</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/best-lightweight-elasticsearch-compatible-server-2026</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/best-local-full-text-search-jsonl-csv-2026</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/best-mcp-server-local-code-search-2026</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-ast-grep</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-docfetcher</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-elasticsearch-local</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-houdahspot</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-khoj</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-localsynapse</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-meilisearch</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-obsidian-omnisearch</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-pagefind</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-recoll</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-ripgrep-all</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-ripgrep-for-code-agents</loc>
- <lastmod>2026-10-20</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-spotlight</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-typesense</loc>
- <lastmod>2026-10-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-vector-database</loc>
- <lastmod>2026-10-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/compare/xerj-vs-web-agent-search</loc>
- <lastmod>2026-08-23</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/demo/</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/agents/</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/agents/endpoints</loc>
- <lastmod>2026-10-17</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/agents/quickstart</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/aggregations</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/analyzers</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/api-es-compat</loc>
- <lastmod>2026-09-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/api-native</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/backup-restore</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/cli</loc>
- <lastmod>2026-10-17</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/clustering</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/compression</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/config</loc>
- <lastmod>2026-09-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/corpus-hub</loc>
- <lastmod>2026-10-17</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/env</loc>
- <lastmod>2026-10-17</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/ingest</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/install</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/metrics</loc>
- <lastmod>2026-09-18</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/migration-from-es</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/operations</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/playbooks/full-text</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/playbooks/log-analytics</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/playbooks/observability</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/playbooks/siem</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/playbooks/vector-search</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/queries</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/quickstart</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/agentic-memory</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/air-gapped-deployment</loc>
- <lastmod>2026-09-19</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/anomaly-detection</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/continuous-anomaly-datafeeds</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/document-folder-index</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/hybrid-search</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/log-analytics</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/migrate-from-elasticsearch</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/passage-retrieval</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/semantic-search-rag</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/vector-quantization</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/vector-search-knn</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/recipes/zero-config-autoindex</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/security</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/storage</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/troubleshooting</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/upgrades</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/docs/vectors</loc>
- <lastmod>2026-09-08</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/for-agents</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/industries/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/industries/finserv</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/industries/healthcare</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/industries/public-sector</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/industries/retail</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/playground</loc>
- <lastmod>2026-10-22</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/pricing/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/product</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/resources/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/security/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/solutions/</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases</loc>
- <lastmod>2026-08-30</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/ai-search-retrieval</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/code-security-audit</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/elasticsearch-replacement</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/operational-intelligence</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/second-brain</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/security-analytics</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/semantic-analytics</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/unified-observability</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
- <url>
- <loc>https://xerj.org/use-cases/zero-token-ai-search</loc>
- <lastmod>2026-10-24</lastmod>
- </url>
-</urlset>
diff --git a/scripts/seo/README.md b/scripts/seo/README.md
index 0fe70343d..76bec933e 100644
--- a/scripts/seo/README.md
+++ b/scripts/seo/README.md
@@ -59,7 +59,7 @@ scripts/seo/urlmap.py ─┘ └─> a spliced block
landing/**/*.html ── fix_heads.py ──> the <!-- seo:begin --> … <!-- seo:end --> block in every <head>, and the GA4 snippet at the top of <head>
landing/**/*.html ── fix_links.py ──> every internal <a href>, plus the site-map footer block
landing/**/*.html ── set_nav.py ───> the primary nav in every page
-landing/**/*.html ── gen_sitemap.py ─> landing/sitemap.xml
+landing/**/*.html ── gen_sitemap.py ─> landing/sitemap.xml (deploy only — gitignored)
(brand tokens) ── mk_og_card.py ──> landing/og/xerj-card.png
```
@@ -75,7 +75,7 @@ landing/**/*.html ── gen_sitemap.py ─> landing/sitemap.xml
| the block between `<!-- seo:begin … -->` and `<!-- seo:end -->` in every page's `<head>` | `fix_heads.py` | edit `scripts/seo/pagedata.py` |
| the block between `<!-- seo:footer-begin … -->` and `<!-- seo:footer-end -->` | `fix_links.py` | edit `FOOTER_MAP` in `fix_links.py` |
| every internal `<a href>` in `landing/` | `fix_links.py` | write the href you mean; the pass rewrites it to the served form |
-| `landing/sitemap.xml` | `gen_sitemap.py` | it is derived from the filesystem and from git |
+| `landing/sitemap.xml` | `gen_sitemap.py` at deploy time | nothing: it is gitignored and `deploy-pages.yml` writes it before the upload |
| `landing/og/xerj-card.png` | `mk_og_card.py` | edit the rasteriser; the brand tokens come from `landing/style.css` |
| the primary nav (`<nav class="nav">`) in every page, and in the `build_articles.py` templates | `set_nav.py` | edit `LEFT` / `RIGHT` in `set_nav.py`, then run it; `--check` verifies |
| the `<a class="nav-stars">` GitHub stars badge in every primary nav (its fallback count) | `stars_badge.py` | run it to refresh the count from the GitHub API; `--check` verifies; `landing/theme.js` refreshes the number in the browser |
@@ -491,13 +491,24 @@ count, the release version or a kNN exactness claim is also subject to
---
-## 5. How to regenerate the sitemap
+## 5. The sitemap
+
+`sitemap.xml` is a **deploy artifact, not a committed file**:
+`.github/workflows/deploy-pages.yml` runs the generator on a full checkout and
+uploads the result with the rest of `landing/`. It is in `.gitignore`, so a
+local run never shows up as a change.
```sh
-python3 scripts/seo/gen_sitemap.py --write # regenerate
-python3 scripts/seo/gen_sitemap.py --check # CI gate; exit 1 on any difference
+python3 scripts/seo/gen_sitemap.py --write # write landing/sitemap.xml locally
+python3 scripts/seo/gen_sitemap.py --check # CI gate: the derivation still validates
```
+Why it is not committed: every landing edit that forgot to re-run the generator
+turned `main` red from `seo.yml` (which reads the file), and every such pull
+request carried a two-line `<lastmod>` conflict. `seo_lint.py`, `audit.py` and
+`verify_live.py` build the document from the tree when the file is absent, so
+they check what the deploy would ship rather than a copy in git.
+
The file is a **derivation**, not a document:
* one `<url>` per HTML file under `landing/`, minus `urlmap.SITEMAP_EXCLUDE` and
@@ -507,19 +518,22 @@ The file is a **derivation**, not a document:
* `<lastmod>` = the page's content date (`DateSource.page_lastmod`): article
`updated:` front matter, else JSON-LD `dateModified`, else a `pagedata.py`
`updated`, else — on a full clone — the last commit that changed more than
- shared chrome (`<head>`, the primary nav, the generated footer). A shallow
- checkout keeps the `<lastmod>` already committed for that URL, and only a
- URL missing from the file falls back to mtime. `git log -1` of the HTML
- file is not the date: a sitewide head commit would stamp every URL today;
+ shared chrome (`<head>`, the primary nav, the generated footer), else mtime.
+ `git log -1` of the HTML file is not the date: a sitewide head commit would
+ stamp every URL today;
* **no `<priority>`, no `<changefreq>`.** Google ignores both; Bing stated in
July 2025 that both are ignored and influence nothing. Emitting them is noise;
* **no non-HTML assets.** A `.txt` or `.json` URL produces no search result.
`llms.txt` is advertised in `robots.txt`, which is where it belongs;
-* one flat sitemap, no index file — 139 URLs against a 50,000-URL limit.
+* one flat sitemap, no index file — 185 URLs against a 50,000-URL limit.
-**Never hand-edit it.** Two independent reasons:
+**Never hand-edit it.** It is not committed at all — `Deploy site
+(Cloudflare Pages)` runs `gen_sitemap.py --write` on a full checkout and
+uploads the result with the rest of `landing/`, and `.gitignore` keeps a local
+`--write` out of `git status`. Two reasons that matters:
-1. `--check` regenerates and byte-compares. A hand edit fails the merge gate.
+1. The served file is derived from the tree it ships with, so it cannot fall
+ behind a landing edit the way a committed copy did.
2. `<lastmod>` is the reason. Google uses `lastmod` only "if it's consistently
and verifiably accurate", and the judgement is **sitewide**: one page whose
`lastmod` drifts from reality teaches the crawler to ignore the field for
@@ -532,10 +546,10 @@ The file is a **derivation**, not a document:
to prevent.
When none of the content dates apply and git cannot answer (uncommitted file,
-shallow clone, no git), the tool keeps the `<lastmod>` already committed for
-that URL. Only a URL that is not in the file yet falls back to the filesystem
-mtime, and that prints `WARNING: <lastmod> fell back to filesystem mtime` on
-stderr. A shallow checkout no longer restamps the whole sitemap to today.
+shallow clone, no git), the tool falls back to the filesystem mtime and prints
+`WARNING: <lastmod> fell back to filesystem mtime` on stderr. That is why the
+deploy checks out with `fetch-depth: 0`: a shallow clone has no commit to date
+the page from, and the warning would list every page it restamped to today.
### 5.1 Tell IndexNow after a production deploy
@@ -569,7 +583,7 @@ changed, and do not resend an unchanged sitemap on a schedule.
| `pagedata.py` | hand-written per-page title/description/JSON-LD-kind/breadcrumb table for non-article pages; falls through to article frontmatter | library | `KeyError` — register the page |
| `seo_head.py` | the one implementation of the `<head>` block, shared by `fix_heads.py` and the article generator | library | n/a |
| `build_articles.py` | renders `content/**/*.md` into pages, Markdown twins, hubs, `index.json` and the `llms.txt` article tree | `--write` / `--check`, `--only SLUG`, `--json`, `--allow-ste-errors` | committed HTML is not what the sources produce, or a source is invalid. Run `--write` and commit |
-| `gen_sitemap.py` | derives `landing/sitemap.xml` from the filesystem and git | `--write` / `--check` | the committed sitemap is stale or hand-edited. Run `--write` |
+| `gen_sitemap.py` | derives `landing/sitemap.xml` (a deploy artifact, gitignored) from the filesystem and git | `--write` (deploy) / `--check` (validate only) | the derivation no longer produces a valid sitemap |
| `fix_heads.py` | owns canonical, the full Open Graph + Twitter set, JSON-LD and `<title>`/description in every page's `<head>` | `--write` / `--check` | a `<head>` was hand-edited or a page is unregistered. Run `--write` |
| `fix_links.py` | rewrites internal `.html` hrefs to the served extensionless form and regenerates the site-map footer | `--write` / `--check` | someone hand-wrote a `.html` link or edited the footer block. Run `--write` |
| `mk_og_card.py` | deterministically rasterises `landing/og/xerj-card.png` (stdlib scanline rasteriser + zlib PNG writer — no Pillow) | `--write` / `--check` | the committed PNG is not the current render. Run `--write` |
@@ -579,7 +593,7 @@ changed, and do not resend an unchanged sitemap on a schedule.
| `claims_rules.py` | the fact-check rule corpus: each rule carries its evidence citation and a compliant rewrite | data | n/a |
| `audit.py` | the full 12-family technical-SEO audit (thinness, duplication, click depth, page weight, image CLS, …). Also supplies the HTML parser that `seo_lint.py` uses, so the auditor and the gate cannot disagree | `--fail-on`, `--max-findings`, `--json`, `--report` | in CI it is **report-only** (`if: always()`), never blocking |
| `indexnow_ping.py` | **manual, never CI**: sends changed URLs to IndexNow (Bing, Yandex, Seznam, Naver and others). The key file is `landing/<key>.txt`; the hub generator writes the same key into its `out/` | dry run by default; `--send`, `--host xerj.org\|hub.xerj.org`, `[URL ...]` | HTTP 403: the key file is not live on that host yet. 422: a URL is not on the host |
-| `verify_live.py` | **post-deploy, never CI**: fetches every `<loc>` in the *committed* sitemap from a live origin and checks a literal 200, a body that is not the homepage, and a canonical equal to the requested URL — plus one probe that a never-existing path answers 404 | `[base]`, `--jobs`, `--limit`, `--timeout`, `--json`, `--skip-not-found-probe` | the deploy does not match the tree. On a PR everything fails, which is why it is not a gate — see §7 |
+| `verify_live.py` | **post-deploy, never CI**: fetches every `<loc>` from a live origin (the sitemap comes from a local `landing/sitemap.xml` if you just generated it, otherwise from the tree) and checks a literal 200, a body that is not the homepage, and a canonical equal to the requested URL — plus one probe that a never-existing path answers 404 | `[base]`, `--jobs`, `--limit`, `--timeout`, `--json`, `--skip-not-found-probe` | the deploy does not match the tree. On a PR everything fails, which is why it is not a gate — see §7 |
`scripts/seo/testdata/factcheck/*.md` is the fact-check regression suite: 21
fixtures, 14 `bad_` and 7 `good_`, every rule required to own at least one.
@@ -595,7 +609,7 @@ fixtures, 14 `bad_` and 7 `good_`, every rule required to own at least one.
| Step | Catches |
|---|---|
| `build_articles.py --check` | committed article HTML/twins/hubs/`index.json`/`llms.txt` block differ from what the sources render; an orphaned generated page; an invalid source; STE ERRORs in any article |
-| `gen_sitemap.py --check` | a stale or hand-edited `sitemap.xml`, including a drifted `<lastmod>` |
+| `gen_sitemap.py --check` | the derivation no longer produces a valid `sitemap.xml` (served URL form, Markdown twins, dead entries). The file itself is built by the deploy, not committed |
| `fix_heads.py --check` | a hand-edited `<head>`; a missing canonical/OG/JSON-LD; a page with no `pagedata.py` entry |
| `fix_links.py --check` | a hand-written `.html` internal link; an edited footer block; a link to a page that does not exist |
| `mk_og_card.py --check` | the committed OG card is not the current render |
@@ -649,9 +663,10 @@ python3 scripts/seo/verify_live.py # https://xerj.org
python3 scripts/seo/verify_live.py https://staging.example.com --jobs 4
```
-It reads the **committed** `landing/sitemap.xml`, never `<base>/sitemap.xml` —
-the question is whether what was committed reached production, and a stale
-deploy must not be allowed to answer for itself. `seo_lint.py`'s header reserves
+It reads the sitemap this tree produces — the generated one, since
+`landing/sitemap.xml` is not committed — never `<base>/sitemap.xml`: the
+question is whether this tree reached production, and a stale deploy must not
+be allowed to answer for itself. `seo_lint.py`'s header reserves
rules 15, 22 and 63 for exactly these three checks; this is where they live.
### The gate that is easy to miss
@@ -722,25 +737,26 @@ page's JSON-LD `dateModified`, then a pinned `pagedata.py` date). It does
**not** use `git log -1` of the generated HTML: a sitewide head commit, and a
shallow checkout whose files all share today's mtime, stamped every URL with
one day. `git log` is only the fallback for a hand-written page that publishes
-no date, and only for a commit that changed more than shared chrome. That
-also means a hand-written page with no pinned date still moves `<lastmod>`
-when you commit a body edit, because that commit is now the content change.
-Re-run `gen_sitemap.py --write` after the commit (and amend, or add a
-follow-up commit) so `--check` sees the same day. A generated article does
-not: its date is `updated:`, and regenerating the HTML does not change it.
+no date, and only for a commit that changed more than shared chrome. A
+generated article does not move on regeneration: its date is `updated:`.
+
+The sitemap is not committed, so no build round is needed for it — `--check`
+validates the derivation and the deploy writes the file.
The stderr warning `WARNING: <lastmod> fell back to filesystem mtime` means a
-URL had no in-file date, no usable git history, and no committed sitemap
-entry. It is expected for a brand-new untracked page and is a bug in CI if it
-fires for a page that is already in `sitemap.xml`.
+URL had no in-file date and no usable git history. It is expected for a
+brand-new untracked page, and is a bug in CI for a page that is already
+published.
### 3. CI needs `fetch-depth: 0`
`actions/checkout` defaults to a shallow clone with no tags. Sitemap
`<lastmod>` does not require that full history for a page that carries
`updated:` or `dateModified`: those dates are in the checkout. A page with
-neither keeps the `<lastmod>` already committed, so a shallow
-`gen_sitemap.py --check` does not restamp the file to today.
+neither is dated from a chrome-stripped git commit, which a shallow clone does
+not have — it falls back to the filesystem mtime, which is the deploy machine's
+checkout time. The deploy therefore fetches full history before it generates
+the sitemap.
`fix_heads.py` can still move a date that is computed from `git log` when the
page has no pinned date and no JSON-LD date to keep, and
`landing-constants-guard.sh` fails differently on the same cause: it
diff --git a/scripts/seo/audit.py b/scripts/seo/audit.py
index 5ce0c10c3..5b7cae548 100755
--- a/scripts/seo/audit.py
+++ b/scripts/seo/audit.py
@@ -41,12 +41,14 @@ markup is the source of truth):
Design notes
------------
-* Stdlib only (html.parser, urllib.parse, xml.etree, json, subprocess). No
+* Stdlib only (html.parser, urllib.parse, xml.etree, json). No
network access: every check is answerable from the working tree.
* `<lastmod>` is compared to `urlmap.DateSource.page_lastmod` (article
`updated`, JSON-LD `dateModified`, a pinned `pagedata` date, then a
- chrome-stripped git date). A shallow checkout keeps the committed sitemap
- value instead of the filesystem mtime. `meta.date_source` is `content-date`.
+ chrome-stripped git date, then the filesystem mtime). The committed
+ `sitemap.xml` is a deploy artifact, so on a shallow checkout the undated
+ URLs fall back to mtime instead of a prior file. `meta.date_source` is
+ `content-date`.
* Nothing is written to the site. This tool measures; it never fixes.
"""
@@ -61,7 +63,6 @@ import json
import os
import pathlib
import re
-import subprocess
import sys
import urllib.parse
import xml.etree.ElementTree as ET
@@ -487,11 +488,23 @@ class Audit:
def _load_sitemap(self):
f = self.root / "sitemap.xml"
- if not f.exists():
- self.notes.append("no sitemap.xml found at site root")
- return
+ if f.exists():
+ text = f.read_text(encoding="utf-8", errors="replace")
+ else:
+ # Not committed: `Deploy site (Cloudflare Pages)` writes it into
+ # landing/ just before the upload. Audit the file that deploy ships.
+ try:
+ import gen_sitemap
+
+ text = gen_sitemap.sitemap_for(self.root)
+ except Exception as exc: # noqa: BLE001 - an audit must not crash
+ self.notes.append(
+ f"no sitemap.xml and it could not be generated: {exc}"
+ )
+ return
+ self.notes.append("sitemap.xml generated in memory (it is not committed)")
try:
- tree = ET.fromstring(f.read_text(encoding="utf-8", errors="replace"))
+ tree = ET.fromstring(text)
except ET.ParseError as exc:
self.notes.append(f"sitemap.xml does not parse: {exc}")
return
@@ -556,8 +569,7 @@ class Audit:
# Same content date gen_sitemap writes, so a sitewide head commit
# does not look like every page changed today.
if getattr(self, "_content_dates", None) is None:
- import urlmap
- self._content_dates = urlmap.DateSource(urlmap.repo_root())
+ self._content_dates = _urlmap.DateSource(_urlmap.repo_root())
self._content_prior = self._content_dates.committed_lastmods(
self.root / "sitemap.xml")
self.date_source = "content-date"
@@ -731,6 +743,10 @@ class Audit:
continue
resolved = self.resolve_url_path(target_path)
if resolved is None:
+ if target_path == "/sitemap.xml":
+ # Written by deploy-pages.yml just before the upload;
+ # it is never a file in the tree, but it ships.
+ continue
key = (target_path, line)
if key not in seen_broken:
seen_broken.add(key)
diff --git a/scripts/seo/gen_sitemap.py b/scripts/seo/gen_sitemap.py
index 79c69bd8a..af22f89f8 100755
--- a/scripts/seo/gen_sitemap.py
+++ b/scripts/seo/gen_sitemap.py
@@ -1,6 +1,14 @@
#!/usr/bin/env python3
"""Regenerate landing/sitemap.xml from the filesystem.
+`landing/sitemap.xml` is a **deploy artifact, not a committed file**: the
+`Deploy site (Cloudflare Pages)` workflow runs `--write` on a full checkout just
+before it uploads `landing/`, so the served sitemap is always derived from the
+tree it ships with. Keeping it in git meant every landing edit that forgot to
+re-run this script turned `main` red from `seo.yml`, and every such PR carried
+a two-line `<lastmod>` conflict. `--check` survives as the gate that the
+derivation still validates; there is no committed copy to compare against.
+
The previous sitemap was hand-maintained: 24 entries for an 80-page site, 18
of which were URLs that 308-redirect rather than pages, four of which were
non-HTML assets (`llms.txt` and three tool-schema JSON files), all 24 carrying
@@ -32,8 +40,8 @@ This script replaces that with a derivation:
One flat sitemap, no index file: at 78 URLs we are three orders of magnitude
under the 50,000-URL / 50 MB limit and an index would only add failure modes.
- python3 scripts/seo/gen_sitemap.py --write
- python3 scripts/seo/gen_sitemap.py --check # exit 1 if committed != generated
+ python3 scripts/seo/gen_sitemap.py --write # deploy: writes landing/sitemap.xml
+ python3 scripts/seo/gen_sitemap.py --check # gate: the derivation still validates
"""
from __future__ import annotations
@@ -82,6 +90,16 @@ def build(root: pathlib.Path, dates: urlmap.DateSource) -> str:
return "\n".join(out) + "\n"
+def sitemap_for(root: pathlib.Path) -> str:
+ """The sitemap `--write` would produce for `root`, dates from git.
+
+ `landing/sitemap.xml` is not committed, so the tools that inspect it
+ (`seo_lint.py`, `audit.py`, `verify_live.py`) call this when the file is
+ absent: they check the bytes the deploy would ship, not a copy in git.
+ """
+ return build(root, urlmap.DateSource(urlmap.repo_root()))
+
+
def validate(xml: str) -> list[str]:
problems = []
data = xml.encode("utf-8")
@@ -103,9 +121,10 @@ def validate(xml: str) -> list[str]:
def main(argv: list[str] | None = None) -> int:
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
- ap.add_argument("--write", action="store_true", help="write landing/sitemap.xml")
+ ap.add_argument("--write", action="store_true",
+ help="write landing/sitemap.xml (the deploy step)")
ap.add_argument("--check", action="store_true",
- help="exit 1 if the committed sitemap differs (CI gate)")
+ help="build and validate the sitemap without writing it (CI gate)")
ap.add_argument("--root", default=None)
args = ap.parse_args(argv)
if not (args.write or args.check):
@@ -144,18 +163,11 @@ def main(argv: list[str] | None = None) -> int:
out = root / "sitemap.xml"
if args.check:
- current = out.read_text(encoding="utf-8") if out.exists() else ""
- if current != xml:
- print("FAIL landing/sitemap.xml is out of date — run "
- "`python3 scripts/seo/gen_sitemap.py --write`", file=sys.stderr)
- cur_locs = set(_locs(current))
- new_locs = set(_locs(xml))
- for loc in sorted(new_locs - cur_locs)[:10]:
- print(f" + {loc}", file=sys.stderr)
- for loc in sorted(cur_locs - new_locs)[:10]:
- print(f" - {loc}", file=sys.stderr)
- return 1
- print(f"ok sitemap.xml matches ({xml.count('<loc>')} URLs)")
+ # sitemap.xml is a deploy artifact: `.github/workflows/deploy-pages.yml`
+ # writes it into landing/ just before the upload, and no copy is
+ # committed. There is therefore nothing to diff against — this mode is
+ # the gate that the derivation still produces a valid sitemap.
+ print(f"ok sitemap.xml generates ({xml.count('<loc>')} URLs)")
return 0
out.write_text(xml, encoding="utf-8")
diff --git a/scripts/seo/indexnow_ping.py b/scripts/seo/indexnow_ping.py
index 2b18f829e..fbb561845 100755
--- a/scripts/seo/indexnow_ping.py
+++ b/scripts/seo/indexnow_ping.py
@@ -7,7 +7,7 @@ Run it by hand after a production deploy. No workflow calls it.
# Print what would be sent (the default: nothing leaves the machine):
python3 scripts/seo/indexnow_ping.py
- # Send every URL in landing/sitemap.xml:
+ # Send every URL in the sitemap (local artifact if present, else the live one):
python3 scripts/seo/indexnow_ping.py --send
# Send only some URLs:
diff --git a/scripts/seo/seo_lint.py b/scripts/seo/seo_lint.py
index 7b169ec8f..f9ec450de 100755
--- a/scripts/seo/seo_lint.py
+++ b/scripts/seo/seo_lint.py
@@ -45,6 +45,7 @@ import xml.etree.ElementTree as ET
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
import audit as audit_mod # noqa: E402 (reuse the auditor's HTML parser)
+import gen_sitemap # noqa: E402 (the sitemap is a deploy artifact, not a file)
import pagedata # noqa: E402
import urlmap # noqa: E402
@@ -252,11 +253,13 @@ class Lint:
def check_sitemap(self) -> None:
sm = self.root / "sitemap.xml"
p = "sitemap.xml"
- if not sm.exists():
- self.gate("sitemap.missing", p, "landing/sitemap.xml does not exist")
- return
-
- data = sm.read_bytes()
+ if sm.exists():
+ data = sm.read_bytes()
+ else:
+ # sitemap.xml is a deploy artifact (deploy-pages.yml writes it into
+ # landing/ before the upload); it is not committed. Lint the bytes
+ # that deploy would ship instead of gating on the file's absence.
+ data = gen_sitemap.sitemap_for(self.root).encode("utf-8")
if data.startswith(b"\xef\xbb\xbf"):
self.gate("sitemap.bom", p, "file starts with a UTF-8 BOM (rule 13)")
try:
@@ -332,7 +335,6 @@ class Lint:
f"{missing} is an indexable page but is not listed (rule 1)")
# rule 4 — the file must be generated, not hand-edited
- import gen_sitemap
dates = urlmap.DateSource(self.repo)
if text != gen_sitemap.build(self.root, dates):
self.gate("sitemap.stale", p,
@@ -342,8 +344,11 @@ class Lint:
# rule 12 — XSD validation, when xmllint is available
xsd = self.repo / "schemas" / "sitemap.xsd"
if shutil.which("xmllint") and xsd.exists():
- r = subprocess.run(["xmllint", "--noout", "--schema", str(xsd), str(sm)],
- capture_output=True, text=True)
+ # Validate the bytes under test, not the path: when the sitemap is
+ # generated in memory (it is a deploy artifact, not a committed
+ # file) there is no file for xmllint to open.
+ r = subprocess.run(["xmllint", "--noout", "--schema", str(xsd), "-"],
+ input=text, capture_output=True, text=True)
if r.returncode != 0:
self.gate("sitemap.xsd", p, f"xmllint: {r.stderr.strip()} (rule 12)")
@@ -908,6 +913,10 @@ class Lint:
f"served URL instead (rule 21)")
target = self._resolve(path, src_dir)
if target is None:
+ if path == "/sitemap.xml":
+ # Written by deploy-pages.yml just before the upload, so
+ # it is never a file in the tree; the artifact has it.
+ continue
if path in KNOWN_BROKEN:
self.warn("link.known_broken", rel,
f"line {line}: {path} — {KNOWN_BROKEN[path]}")
diff --git a/scripts/seo/test_audit_dates.py b/scripts/seo/test_audit_dates.py
new file mode 100755
index 000000000..d5eea7fe2
--- /dev/null
+++ b/scripts/seo/test_audit_dates.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+"""The audit dates a page the same way the sitemap generator does.
+
+`landing/sitemap.xml` is a deploy artifact and is not in the tree, so the audit
+builds the document it would ship and compares each `<lastmod>` against a date
+from the same `urlmap.DateSource`. If the two ever read different dates (a
+`git log --format=%cs` here, a UTC-normalised content date there) a freshly
+generated sitemap reports itself stale.
+
+Run: python3 scripts/seo/test_audit_dates.py
+"""
+
+import pathlib
+import sys
+import unittest
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
+
+import audit # noqa: E402
+import urlmap # noqa: E402
+
+PAGE = "index.html"
+
+
+class SitemapDateTests(unittest.TestCase):
+ def setUp(self):
+ self.landing = urlmap.landing_dir()
+ self.audit = audit.Audit(self.landing)
+
+ def test_a_published_page_has_a_date(self):
+ self.assertRegex(self.audit.last_change_date(PAGE) or "",
+ r"^\d{4}-\d{2}-\d{2}$")
+
+ def test_a_page_that_is_not_in_the_tree_has_no_date(self):
+ self.assertIsNone(self.audit.last_change_date("no-such-page.html"))
+
+ def test_the_shipped_sitemap_never_reports_itself_stale(self):
+ self.audit.load()
+ self.audit.run()
+ stale = [f for f in self.audit.findings if f.check == "sitemap.stale_lastmod"]
+ self.assertEqual([(f.path, f.message) for f in stale], [])
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/scripts/seo/verify_live.py b/scripts/seo/verify_live.py
index 4f2fb4b65..848dae6ef 100755
--- a/scripts/seo/verify_live.py
+++ b/scripts/seo/verify_live.py
@@ -48,10 +48,11 @@ Plus one probe that needs no sitemap: a path that has never existed must
answer **404**, not 200. That single request is the fastest way to tell
whether the not-found handling is still correct after any deploy.
-The sitemap comes from the **committed** `landing/sitemap.xml`, never from
-`<base>/sitemap.xml`. The question being asked is "did what we committed
-actually reach production", and reading the deployed sitemap would let a
-stale or truncated deploy answer for itself.
+The sitemap comes from this tree — a local `landing/sitemap.xml` if one is
+there, otherwise the document `gen_sitemap.py` derives from the tree — never
+from `<base>/sitemap.xml`. The question being asked is "did what this tree
+says should be live actually reach production", and reading the deployed
+sitemap would let a stale or truncated deploy answer for itself.
Usage
-----
@@ -178,9 +179,9 @@ def _canonical_of(body: bytes) -> str | None:
return h.group(1).strip() if h else None
-def sitemap_urls(sitemap: pathlib.Path) -> list[str]:
- """Every `<loc>` in the committed sitemap, in document order."""
- root = ET.parse(sitemap).getroot()
+def sitemap_urls(text: str) -> list[str]:
+ """Every `<loc>` in a sitemap document, in document order."""
+ root = ET.fromstring(text)
out = []
for u in root.findall(f"{SITEMAP_NS}url"):
loc = (u.findtext(f"{SITEMAP_NS}loc") or "").strip()
@@ -244,7 +245,8 @@ def main(argv: list[str] | None = None) -> int:
ap.add_argument("base", nargs="?", default=urlmap.SITE_ORIGIN,
help=f"origin to test (default {urlmap.SITE_ORIGIN})")
ap.add_argument("--sitemap", default=None,
- help="committed sitemap (default landing/sitemap.xml)")
+ help="sitemap file to read (default landing/sitemap.xml, "
+ "else generated from the tree)")
ap.add_argument("--jobs", type=int, default=8, help="parallel requests (default 8)")
ap.add_argument("--timeout", type=int, default=DEFAULT_TIMEOUT)
ap.add_argument("--limit", type=int, default=0, help="test only the first N URLs")
@@ -259,11 +261,20 @@ def main(argv: list[str] | None = None) -> int:
sitemap = (pathlib.Path(args.sitemap) if args.sitemap
else urlmap.landing_dir() / "sitemap.xml")
- if not sitemap.is_file():
+ if sitemap.is_file():
+ text = sitemap.read_text(encoding="utf-8", errors="replace")
+ elif args.sitemap:
print(f"verify_live: no sitemap at {sitemap}", file=sys.stderr)
return 2
+ else:
+ # landing/sitemap.xml is a deploy artifact and is not committed, so
+ # fall back to the document the deploy would have shipped from this
+ # tree — the question is still "did this tree reach production".
+ import gen_sitemap
+
+ text = gen_sitemap.sitemap_for(urlmap.landing_dir())
try:
- locs = sitemap_urls(sitemap)
+ locs = sitemap_urls(text)
except ET.ParseError as e:
print(f"verify_live: {sitemap} does not parse: {e}", file=sys.stderr)
return 2