BoilerPrompt
GitHub Copilot

GitHub Copilot prompt to build a blog with a CMS

A markdown-plus-frontmatter blog is the CMS setup that needs no admin panel, and it maps cleanly onto chat-driven file generation. Here GitHub Copilot builds the post loader, list, detail, and RSS routes off one shared function, with draft filtering and a build that fails loudly on bad frontmatter.

Last updated

Prompt
Build a blog where content lives as markdown files with frontmatter, title, date, slug, draft, in content/posts/. Write lib/posts with two functions: getAllPosts, sorted newest first and excluding draft true, and getPostBySlug, which parses the body to HTML. Add a listing page at /blog showing title, date, and a 30-word excerpt cut at a word boundary, and a detail page at /blog/[slug] that returns a real 404 for unknown slugs rather than an empty shell. Generate an RSS feed at /feed.xml from the same getAllPosts call so listing and feed can never disagree. Malformed frontmatter should fail the build with the offending filename in the error, not render a broken card. Ask me for the framework in this repo before scaffolding routes. Verification: I will add one draft post and one published post, build, and confirm exactly one appears in both the list and the feed.

Same task in other tools

Questions about this prompt

Why fail the build on malformed frontmatter instead of skipping the post?

A skipped post vanishes silently and you find out weeks later. A build error naming the file costs seconds and keeps the list, detail, and feed consistent.

How would I move to a hosted headless CMS later?

getAllPosts and getPostBySlug are the seam. Reimplement those two functions against the CMS API inside lib/posts and the listing page, slug route, and feed need no edits.

A draft post appeared in the RSS feed but not on /blog. Why?

The feed built its own file query instead of calling getAllPosts. Ask Copilot to list every place that reads content/posts/ and collapse them onto the one function.

Related prompts