Docs
Blog Flow
Blog Flow
Content management and blog system with MDX and Contentlayer
Blog Flow
Overview
Manages blog content creation, organization, and rendering using Contentlayer and MDX. Provides a complete blog system with categories, authors, and related articles functionality. The blog serves as a content marketing platform for the SaaS application.
Main Libraries/Services:
contentlayer2- Content management and static generationMDX- Markdown with JSX components for rich content@tailwindcss/typography- Typography styling for blog contentrehypeandremarkplugins for content processing
File Map
š config/blog.ts - Blog configuration (categories, authors)
š contentlayer.config.ts - Contentlayer configuration for blog posts
š content/blog/ - MDX blog post files
š app/(marketing)/blog/page.tsx - Main blog listing page
š app/(marketing)/blog/category/[slug]/page.tsx - Category filtered posts
š app/(marketing)/(blog-post)/blog/[slug]/page.tsx - Individual blog post page
š app/(marketing)/blog/layout.tsx - Blog layout wrapper
š components/content/blog-posts.tsx - Blog posts grid component
š components/content/blog-card.tsx - Individual blog post card
š components/content/blog-header-layout.tsx - Blog header with navigation
š components/content/author.tsx - Author display component
š components/content/mdx-components.tsx - MDX component mapping
Step-by-Step Flow
Blog Post Creation
- Create new MDX file in
content/blog/directory - Add frontmatter with required fields:
title: Post titledescription: Post descriptionimage: Featured image pathdate: Publication dateauthors: Array of author usernamescategories: Array of category slugsrelated: Optional related post slugs
- Write content using MDX syntax with custom components
- Contentlayer processes the file during build
- Static routes are generated for the new blog post
Blog Listing Page
- User navigates to
/blog app/(marketing)/blog/page.tsxloads all published posts- Posts are filtered by
published: true - Posts are sorted by date (newest first)
- Blur data URLs are generated for all post images
BlogPostscomponent renders the grid layout- First post displays horizontally, others in grid
Category Filtering
- User clicks category link in blog header
- Navigates to
/blog/category/[slug] app/(marketing)/blog/category/[slug]/page.tsxreceives category slug- Posts are filtered by matching category
- Category information is displayed in header
- Filtered posts are rendered in grid layout
Individual Blog Post
- User clicks on blog post card
- Navigates to
/blog/[slug] app/(marketing)/(blog-post)/blog/[slug]/page.tsxfinds post by slug- Post metadata is generated for SEO
- Table of contents is extracted from content
- Related articles are found and displayed
- MDX content is rendered with custom components
- Author information and social links are displayed
Content Processing Pipeline
- Contentlayer scans
content/blog/for MDX files - Files are processed as
Postdocument type - Frontmatter is validated against schema
- MDX content is transformed with plugins:
remarkGfmfor GitHub Flavored MarkdownrehypeSlugfor heading IDsrehypePrettyCodefor syntax highlightingrehypeAutolinkHeadingsfor heading links
- Static routes are generated for all posts
Data Flow Diagram
flowchart TD
A[MDX Blog Posts] --> B[Contentlayer Processing]
B --> C[Static Generation]
C --> D[Blog Listing Page]
C --> E[Category Pages]
C --> F[Individual Post Pages]
D --> G[BlogPosts Component]
E --> H[Filtered Posts]
F --> I[MDX Rendering]
G --> J[BlogCard Components]
H --> J
I --> K[Author Components]
I --> L[Related Articles]Dependencies & Contracts
Blog Configuration
BLOG_CATEGORIES: Array of category objects with title, slug, and descriptionBLOG_AUTHORS: Object mapping author usernames to author data
Post Schema
{
title: string (required)
description?: string
date: string (required)
published?: boolean (default: true)
image: string (required)
authors: string[] (required)
categories: ("news" | "education")[] (required)
related?: string[]
}Author Schema
{
name: string;
image: string;
twitter: string;
}Known Limitations
- Only two categories supported: "news" and "education"
- Author images must be stored in
/_static/avatars/directory - Related articles must reference existing post slugs
- No dynamic category creation - must be defined in config
- No draft/publish workflow - uses
publishedfrontmatter field
Notes & TODOs
- ā MDX blog posts with rich content support
- ā Category filtering and navigation
- ā Author management with social links
- ā Related articles functionality
- ā SEO metadata generation
- ā Table of contents for long posts
- ā Responsive image handling with blur placeholders
- ā ļø Limited to two predefined categories
- š Add more blog categories (tutorials, case studies, etc.)
- š Implement blog post search functionality
- š Add blog post tags system
- š Create blog post series functionality
- š Add blog post comments system
- š Implement blog post analytics
- š Add blog post scheduling for future publication