md-blog-core
v1.0.1
Published
Simple Markdown blog engine for Git-based workflows
Maintainers
Readme
md-blog-core
Simple Markdown blog engine for Git-based workflows
Philosophy
- No Admin UI - Just Markdown files
- No Database - Git is your CMS
- No Auth - Push to publish
- Zero Config - Works out of the box
Installation
npm install md-blog-coreUsage
Basic Usage
import { getAllPosts, getPostBySlug } from 'md-blog-core';
// Get all posts
const posts = getAllPosts();
// Get specific post
const post = getPostBySlug('my-first-post');With Next.js
// app/blog/page.tsx
import { getAllPosts } from 'md-blog-core';
export default function BlogPage() {
const posts = getAllPosts();
return (
<div>
{posts.map(post => (
<article key={post.slug}>
<h2>{post.title}</h2>
<time>{post.date}</time>
<div>{post.content}</div>
</article>
))}
</div>
);
}Custom Content Directory
const posts = getAllPosts({ contentDir: 'posts' });File Structure
your-project/
└── content/
└── posts/
├── 2026-01-24-my-first-post.md
└── 2026-01-25-second-post.mdFrontmatter Format
---
title: "My Post Title"
date: "2026-01-24"
tags: ["javascript", "nextjs"]
---
Your markdown content here...API
getAllPosts(config?)
Get all blog posts sorted by date (newest first).
Parameters:
config.contentDir(optional): Content directory path. Default:'content/posts'
Returns: Post[]
getPostBySlug(slug, config?)
Get a single post by its slug.
Parameters:
slug: The post slug (filename without date prefix and.md)config.contentDir(optional): Content directory path. Default:'content/posts'
Returns: Post | null
Post Type
interface Post {
slug: string;
title: string;
date: string;
tags: string[];
content: string;
}Use Cases
- Personal blogs
- Documentation sites
- Technical notes
- Team wikis
- Static site generation
License
MIT
