Himangshu's Blog

Thoughts, tutorials & insights

Creating a Markdown Blog in Next.js

Published:2025-05-17

My Journey Building a Next.js Markdown Blog

Over the last few days, I've created a markdown blog using Next.js. Coming from a WordPress background, this was an exciting new experience that taught me several valuable concepts.

Key Learnings

File System Operations

  • Learned to use Node.js File System (fs) to:
    • Read from folders and files
    • Create custom paths
    • Generate slugs from file paths

Markdown Processing

  • Implemented gray-matter to extract frontmatter metadata
  • Converted markdown to HTML using remark plugins
  • Added tailwind typography plugin to global.css

Next.js Features

  • Utilized Static Site Generation (SSG) for optimal performance
  • Created different layouts for homepage and individual posts
  • Implemented semantic HTML with <header> and <section> elements