tesu.dev

← Back to blog

Hello World

2025-11-19

This is my first blog post.

Building a Markdown-Based Blog

I recently implemented a blog system for this static site. The design philosophy centered on simplicity—creating a straightforward mechanism for writing and publishing content without unnecessary abstraction.

Architecture

The blog consists of two primary routes:

  • /blog - An index of articles, each linked to its corresponding detail page
  • /blog/[slug] - Individual article views that render markdown as HTML

The entire system leverages static generation at build time, eliminating runtime overhead and simplifying deployment.

Technical Considerations

Dependencies

The implementation relies on three core libraries:

  • gray-matter - Extracts YAML frontmatter from markdown files
  • remark + remark-html - Handles markdown-to-HTML transformation
  • @tailwindcss/typography - Provides typographic styling for prose content

Structure

posts/           # Markdown source files
lib/posts.ts     # File system and parsing utilities
app/blog/        # Route handlers

The lib/posts.ts module encapsulates all markdown processing logic. It reads files from the posts directory, parses their frontmatter, and transforms the content into HTML.

Static Generation

By utilizing Next.js's generateStaticParams, each blog post is pre-rendered during the build process. This approach offers several advantages:

  • No server infrastructure required
  • Consistent performance regardless of traffic
  • Simplified hosting and deployment

Content Workflow

Creating a new post requires only a markdown file in the posts directory:

---
title: "Your Post Title"
date: "2025-11-19"
---

Your content here...

Running npm run build regenerates the static site with the new content.

Future Considerations

The current implementation is deliberately minimal. Potential enhancements include:

  • Taxonomy through tags or categories
  • RSS feed generation
  • Improved date formatting
  • Reading time estimation

For now, the system serves its purpose—a frictionless way to publish written content.