Skip to content

Pre-render blog posts for LLM and search engine accessibility#751

Open
MaxGhenis wants to merge 1 commit intomainfrom
prerender-blog-for-llms
Open

Pre-render blog posts for LLM and search engine accessibility#751
MaxGhenis wants to merge 1 commit intomainfrom
prerender-blog-for-llms

Conversation

@MaxGhenis
Copy link
Contributor

Summary

  • Adds build-time pre-rendering of all blog posts as standalone HTML files
  • Middleware now detects LLM user agents (GPTBot, ChatGPT-User, Claude-Web, PerplexityBot, etc.) and serves full article content instead of the empty SPA shell
  • Search engine bots (Googlebot, Bingbot, etc.) also get full pre-rendered content, improving indexing beyond just OG tags
  • Social media crawlers continue to get the existing OG-tag-only response

How it works

  1. Build step: generate-prerender.ts reads all articles, transforms charts/iframes to text placeholders, converts markdown to HTML, and writes /prerender/{slug}.html files
  2. Middleware: Detects user agent type and routes accordingly:
    • LLM bots + search engines → full pre-rendered HTML with article content
    • Social media crawlers → OG tags only (existing behavior)
    • Browsers → SPA (existing behavior)

Closes #750

Test plan

  • Verify 30 middleware tests pass (14 new tests for LLM bot detection)
  • Verify pre-rendered files are generated during build
  • After deploy, test with curl -H "User-Agent: GPTBot" https://policyengine.org/us/research/tanf-50-state-coverage to confirm full content is returned

🤖 Generated with Claude Code

Blog posts are fully client-side rendered, so LLMs and non-JS clients get
empty HTML. This adds build-time pre-rendering:

- New generate-prerender.ts script produces standalone HTML for each article
- Middleware detects LLM user agents (GPTBot, Claude, Perplexity, etc.) and
  serves pre-rendered content instead of the empty SPA shell
- Search engine bots also get full content instead of just OG tags
- Social media crawlers continue to get the existing OG-tag response

Closes #750

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Building Building Preview, Comment Feb 26, 2026 4:01am
policyengine-calculator Building Building Preview, Comment Feb 26, 2026 4:01am

Request Review

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.

Blog posts are inaccessible to LLMs and crawlers (client-side rendering)

1 participant