Skip to content
For the complete Netlify documentation index, see llms.txt. Markdown versions of any documentation page are available by appending .md to its URL.

More flexibility and credits now available for Pro plans 🎉

add-a-blog

Back to templates

Add a blog with listing page, sample posts, RSS feed, sitemap, and draft previews via Netlify deploy contexts — all file-based, no CMS needed.

·Updated Mar 18, 2026·3 variables
Using your project’s framework, add a blog to this site with RSS and Netlify deploy-preview drafts. Blog name: {{BLOG_NAME}} Content focus: {{CONTENT_FOCUS}} Number of sample posts (defaults to 2 if not specified): {{SAMPLE_POST_COUNT}} Create the following: Blog listing page that shows posts in reverse chronological order with title, date, short excerpt, and a “Read more” link. Sample blog posts about {{CONTENT_FOCUS}}. Keep them short — they’re placeholders the site owner will replace with real content. Do not use lorem ipsum. Post pages with title, publication date, the full post content, and a “Back to blog” link. Navigation: Add a “{{BLOG_NAME}}” link to the main site navigation. New post instructions: Include a comment at the top of a sample post explaining how to add a new one (where to create the file, what frontmatter to include). RSS feed: Generate an RSS 2.0 feed at /blog/rss.xml (or /feed.xml ) with all published posts. Add a <link rel="alternate" type="application/rss+xml"> tag to the site’s <head>. Draft posts via Netlify deploy previews: Support a draft: true frontmatter field that hides posts in production builds. In deploy preview builds, show draft posts with a visible “DRAFT” badge. Use Netlify’s CONTEXT environment variable to detect the deploy context. Mark one sample post as a draft to demonstrate this. Caching headers: Add blog-specific cache headers in netlify.toml — HTML pages get Netlify-CDN-Cache-Control: public, max-age=0, stale-while-revalidate=86400 so new posts appear quickly while the CDN serves stale content during revalidation. Blog posts are stored as files in the project repository. No database or CMS is needed. Match the site’s existing design for all new pages.

Variables

The name that appears in navigation and the blog listing page title.

The topic area for sample posts — these are placeholders you'll replace with real content.

How many sample posts to generate. Defaults to 3.