# Recipes

Configs you can paste. Minimal working setups for the stacks developers actually use. Each recipe follows the same shape: request → match → respond → cache.

## Web servers

- [Nginx](https://acceptmarkdown.com/recipes/nginx) — Serve Markdown from the same URL as HTML using Nginx's `map` + `try_files`.
- [Caddy](https://acceptmarkdown.com/recipes/caddy) — Caddy's named matchers make content negotiation concise. Serve pre-rendered `.md` files to agents and HTML to browsers from the same URL.
- [Apache](https://acceptmarkdown.com/recipes/apache) — Serve prebuilt Markdown and HTML from the same canonical URL in Apache using rewrite + proxy fallback for strict `Accept` handling.

## Node.js

- [Cloudflare Workers](https://acceptmarkdown.com/recipes/cloudflare-workers) — Static site on Workers Assets with a thin negotiation Worker — proper `q`-values, `Vary: Accept`, `406`, and `Link: rel="alternate"`. Bring your own Markdown build step.
- [Next.js](https://acceptmarkdown.com/recipes/nextjs) — Middleware-driven negotiation for Next.js App Router, with proper `Accept` parsing, `Vary`, `406`, and deploy-target notes for Vercel, Cloudflare, and self-hosted Node.
- [Astro](https://acceptmarkdown.com/recipes/astro) — Middleware-driven negotiation for Astro, with adapter-specific notes for Cloudflare, Vercel, and Node.
- [SvelteKit](https://acceptmarkdown.com/recipes/sveltekit) — Use a SvelteKit `handle` hook for `Accept` negotiation and serve Markdown from route endpoints with `Vary: Accept`, `406`, and `Link: rel="alternate"`.
- [Nuxt / Nitro](https://acceptmarkdown.com/recipes/nuxt-nitro) — Implement strict `Accept` negotiation in Nitro server middleware and serve Markdown from API routes with `Vary: Accept`, `406`, and `Link: rel="alternate"`.
- [Express](https://acceptmarkdown.com/recipes/express) — A plain Express middleware + route pattern for strict `Accept` negotiation with Markdown siblings, `Vary: Accept`, `406`, and `Link: rel="alternate"`.

## PHP, Ruby, Python

- [WordPress](https://acceptmarkdown.com/recipes/wordpress) — The [Roots](https://roots.io/) post-content-to-markdown plugin serves post content as Markdown when requested via the `Accept` header, with proper `Vary`, `406`, and q-value handling.
- [Laravel](https://acceptmarkdown.com/recipes/laravel) — Three approaches — Markdown-as-source, HTML-in-database, or middleware that converts rendered Blade/Livewire output to Markdown on request.
- [Rails](https://acceptmarkdown.com/recipes/rails) — Rails ships a `text/markdown` MIME type, a `markdown:` renderer, and auto `Vary: Accept`. Define `to_markdown` on your model and `respond_to` the `:md` format.
- [Django](https://acceptmarkdown.com/recipes/django) — Add negotiation middleware in Django and return Markdown or HTML from the same view with proper `Vary: Accept` and `406` semantics.