HeadlinesBriefing favicon HeadlinesBriefing.com

Building a GitBook-Style Docs Site with Next.js and Cloudflare

DEV Community •
×

RouteBot built a documentation site that auto-discovers Markdown files, generates navigation from filename prefixes, and deploys as static assets. The stack includes Next.js 14 (App Router), remark for Markdown processing, and Cloudflare Workers for hosting. It delivers a GitBook-like UI with sidebar, table of contents, and clean URLs without extra prefixes.

This approach eliminates manual navigation config. You just drop `.md` files into a `content/` directory. The system extracts titles from the first H1 or frontmatter, descriptions from the first paragraph, and uses numeric prefixes for ordering. Search is client-side with a build-time generated JSON index, keeping hosting simple and fast.

SEO is handled automatically with per-page metadata, canonical URLs, Open Graph/Twitter cards, and JSON-LD structured data. A static `sitemap.xml` and `robots.txt` are generated from the content. The entire site is exported as static files, perfect for CDN hosting. Future improvements could add syntax highlighting or versioned docs.