tips
4 min

How to Add Blog Posts to Your Cook Book Website

Learn how to easily add new blog posts using markdown files with frontmatter metadata and images.

How to Add Blog Posts to Your Cook Book Website

How to Add Blog Posts to Your Cook Book Website

This is an example post demonstrating the dynamic blog system

Adding new blog posts to your Cook Book website is incredibly simple. You don't need to edit any code, configure databases, or learn complex systems. Just drop a markdown file in the blog-posts folder, and you're done!

Why This System is Amazing

The Cook Book blog uses a file-based content management system that:

  • Automatically discovers new posts
  • Generates beautiful URLs
  • Categorizes content intelligently
  • Optimizes for search engines
  • Deploys in minutes

How It Works

When you create a new .md file in the blog-posts directory:

  1. The system reads it - During the build process, the blog loader scans the folder
  2. Parses the content - Extracts your title, content, and any metadata
  3. Generates a page - Creates a fully-optimized static HTML page
  4. Makes it searchable - Indexes your content for instant search

No manual configuration needed!

Adding Images to Your Posts

Important: You must include an image field in your frontmatter for each blog post. The system no longer generates random images.

Frontmatter Format

Add metadata to the top of your markdown file using YAML frontmatter:

```yaml

title: "Your Post Title" date: "2024-05-20" category: "recipe" excerpt: "A brief description of your post" image: "https://images.unsplash.com/photo-xxxx?w=800&h=600&fit=crop" featured: false

```

Available Fields

  • title (optional) - The post title. If not provided, extracted from the first heading
  • date (optional) - Publication date in YYYY-MM-DD format. Defaults to current date
  • category (optional) - One of: recipe, restaurant, food-news, tips, review
  • excerpt (optional) - Short description shown on listing pages
  • image (required) - URL to the hero image for your post
  • featured (optional) - Set to true to feature on homepage

Where to Get Images

Recommended sources:

  • Unsplash - Free high-quality food photography
  • Pexels - Free stock photos
  • Your own photos hosted on your server

Image URL format: ``` https://images.unsplash.com/photo-1234567890?w=800&h=600&fit=crop ```

Example: Adding a New Recipe

Let's say you want to share your grandmother's secret coconut rice recipe:

  1. Create a file named Grandmas Secret Coconut Rice Recipe.md
  2. Write your content in simple Markdown
  3. Save the file
  4. Commit and push to GitHub
  5. Vercel automatically rebuilds and deploys

That's it! Your recipe is now live on the internet.

Advanced Features

Frontmatter for Control

Want more control? Add frontmatter:

---
title: "Grandma's Secret Coconut Rice"
author: "Your Name"
category: recipe
featured: true
---

Draft Mode

Working on a post but not ready to publish? Just prefix the filename with an underscore:

  • _Work In Progress Recipe.md - Won't be published
  • Work In Progress Recipe.md - Will be published

Categories

Posts are automatically categorized based on keywords:

  • Recipe - Cooking instructions, ingredients, how-tos
  • Restaurant - Reviews, food business stories
  • Tips - Cooking hacks, techniques, secrets
  • Food News - Industry news, trends
  • Review - Product reviews, taste tests

Markdown Formatting

You can use all standard Markdown features:

  • Bold text with **text**
  • Italic text with *text*
  • Headings with #, ##, ###
  • Lists with - or numbers
  • Links with [text](url)
  • Images with ![alt](url)

The Beauty of This System

This blogging system represents the perfect balance:

  • Simple - Just write markdown files
  • Powerful - Full static site generation
  • Fast - Pre-rendered pages load instantly
  • Free - No database or CMS costs
  • Flexible - Full control over content

You get the simplicity of a file system with the power of a modern web application.

Try It Yourself

Go ahead and create your own blog post. The only limit is your imagination!

Happy blogging! 🎉

Enjoyed this article?

Explore more delicious recipes, cooking tips, and food stories

Back to Home