Test: How Easy Is It To Add A New Blog Post?
This is a demonstration blog post created to show how incredibly simple it is to add new content to the Pupam blog.
What I Did
- Created this file:
app/[locale]/blog/test-new-blog-post.mdx - Added frontmatter with metadata
- Wrote some content
- That's it!
What Happens Automatically
✅ The blog post appears on /blog listing page
✅ Individual post accessible at /blog/test-new-blog-post
✅ Read time calculated automatically
✅ Tags extracted and displayed
✅ Sorted by date (newest first)
✅ Featured badge if featured: true
The Magic Behind It
The getAllBlogPosts() function in lib/blog.ts:
- Scans the blog directory for
.mdxfiles - Parses frontmatter metadata
- Calculates read time based on word count
- Sorts posts by date
- Returns a clean array of blog posts
Frontmatter Fields
---
title: "Your Post Title" # Required
description: "Brief description" # Required
author: "Your Name" # Required
date: "2025-10-25" # Required (YYYY-MM-DD)
updated: "2025-10-25" # Optional
tags: ["Tag1", "Tag2"] # Required (array)
featured: true # Optional (boolean)
image: "/blog/image.png" # Optional
canonical: "https://..." # Optional
---
Features You Get For Free
Automatic Features
- Read time calculation: Based on word count (200 words/min)
- Date formatting: Converts to "October 25, 2025" format
- Slug generation: Filename becomes URL slug
- Sorting: Newest posts first
- Tag filtering: All tags extracted automatically
UI Features
- Beautiful card layout on listing page
- Featured post badges
- Author avatars
- View counts (placeholder)
- Comment counts (placeholder)
- Responsive design
- Dark mode support
Testing This Post
Visit these URLs:
-
Listing page:
http://localhost:8668/en/blog- You should see this post at the top (it's dated today and featured)
-
Individual post:
http://localhost:8668/en/blog/test-new-blog-post- Full post with all styling
Adding Your Real Blog Post
Just copy this structure:
# Create new file
touch app/[locale]/blog/your-post-slug.mdx
Add frontmatter and content:
---
title: "Your Awesome Post Title"
description: "What your post is about"
author: "Your Name"
date: "2025-10-25"
tags: ["Relevant", "Tags"]
featured: false
---
# Your Content Here
Write your amazing content...
Save the file, and it instantly appears on your blog!
Optional: Update Meta
If you want to keep _meta.json in sync for Nextra:
npm run generate-blog-meta
This updates the metadata file automatically.
Cleanup
When you're done testing this demo post, just delete this file:
rm app/[locale]/blog/test-new-blog-post.mdx
The blog will automatically update and remove it from the listing.
Summary
Question: Will adding a new blog be as simple as creating a new MDX file?
Answer: YES! ✅
- Create MDX file → Blog post appears
- No database updates needed
- No config file changes needed
- No manual registration needed
- Completely automatic
This test post demonstrates the automatic blog system. Feel free to delete it when you're satisfied it works!