Skip to content

Fix production metadata and header bugs - #2024

Merged
benbalter merged 1 commit into
mainfrom
audit-prod-bugs
Sep 27, 2026
Merged

benbalter merged 1 commit into
mainfrom
audit-prod-bugs

Conversation

@benbalter

Copy link
Copy Markdown
Owner

Production bugs found in a general audit. Each one was confirmed on the live site or in a local build.

  • /stats was public. The bundle visualizer wrote stats.html into dist-astro/, so it deployed; ben.balter.com/stats returns 200 today. It's now opt-in (ANALYZE=1) and writes to .astro/.
  • Broken JSON-LD image. The image on the 18F vs. USDS post was https://ben.balter.com//ben.balter.com/wp-content/... because the old check only looked for an http prefix. It now uses new URL(image, site). Added a test.
  • Markdown negotiation headers.
    • The Markdown response built its headers from scratch, so it dropped CSP, Link, Permissions-Policy, COOP, and CORP. It now starts from the asset's headers.
    • HTML for pages now sends Vary: Accept.
    • Worker tests cover both.
  • dateModified. Posts now emit a git-based dateModified / article:modified_time, reusing the sitemap's lastmod index, which skips sweep commits. Previously it always equaled datePublished. 57 posts pick up a modified date.
  • .md agent files. Root-relative links are now absolute; 23 posts were affected. This adds an absolutizeMarkdownLinks util with tests.
  • Feed fixes.
    • RSS <author> is now email (Name), as RSS 2.0 requires.
    • index.md called the feed "Atom"; it now says RSS.
    • Removed the /feed/index.xml route. _redirects already returns a 301 (checked live), and the route only made the build write a meta-refresh HTML page to a .xml path.

Verification

  • npm run check: clean.
  • Vitest: 2013 passed.
  • SKIP_PDF=1 npm run build: no stats.html in the output, no doubled host, and no ](/ left in the .md files.

🤖 Generated with Claude Code

- Stop shipping the bundle visualizer report to /stats (opt-in via ANALYZE=1, written to .astro/)
- Resolve JSON-LD images with new URL() so protocol-relative images don't double the host
- Carry _headers (CSP, Link, Permissions-Policy) onto Markdown responses; add Vary: Accept to negotiable HTML
- Emit git-based dateModified / article:modified_time on posts, sharing the sitemap lastmod index
- Make root-relative links absolute in per-post .md agent files
- RSS author as "email (Name)"; index.md calls the feed RSS, not Atom
- Remove the /feed/index.xml route; _redirects already 301s it, and the build wrote a meta-refresh page to a .xml path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@benbalter
benbalter merged commit b652389 into main Sep 27, 2026
22 checks passed
@benbalter
benbalter deleted the audit-prod-bugs branch September 27, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant