Direct Markdown Access for Blog Posts
April 29, 2026
I added a small but useful improvement to this site: each blog post can now be accessed directly as a Markdown file by appending .md to its URL.
This means a single post now has two representations:
- a regular web page for reading in the browser
- a raw Markdown response for machine-friendly use
For example:
/blog/circle-revealrenders the regular HTML page/blog/circle-reveal.mdreturns the raw Markdown source
The .md response includes both frontmatter and body content, so it can be reused in external tools, scripts, and feed-like integrations without scraping HTML.
How it works (light version)
I added an API-style route at src/pages/blog/[slug].md.ts. At build time, Astro reads post entries from the content collection (getCollection("posts")) and generates one .md route per slug.
When a request comes in:
- the route finds the matched post data
- it converts metadata into frontmatter text
- it appends the original Markdown body
- it returns everything with
Content-Type: text/markdown
So instead of reverse-engineering rendered HTML, tools can consume the post in its original writing format.
Why this is useful
Direct Markdown access is convenient for:
- personal archiving / backups
- script-based content processing
- lightweight integrations with external services
- AI ingestion (LLM context input, summarization, and embeddings/indexing pipelines)
- future tooling (for example, syncing or indexing workflows)
In addition to blog posts, the same .md access pattern is available for project entries.