A simple, elegant static site generator with clean, minimal design. Transform your markdown files into a beautiful, readable website with ease!
Demo: https://hnstaticgen.netlify.app/
- π¨ Clean & Minimal Design - Beautiful, distraction-free reading experience with clean typography
- π Markdown Support - Write in markdown with extended features (tables, footnotes, task lists, code highlighting)
- π Zero Configuration - Works out of the box with sensible defaults
- π‘ RSS Feed - Automatic RSS feed generation for your blog
- πΊοΈ Sitemap - SEO-friendly sitemap generation
- π·οΈ Tags/Categories - Organize your posts with tags
- π Draft Posts - Mark posts as drafts to hide them from publication
- β‘ Development Server - Built-in server for local preview
- π Watch Mode - Auto-rebuild when files change
- π¦ Asset Management - Automatic copying of images and other assets
- π Syntax Highlighting - Beautiful code highlighting with highlight.js
- π± Responsive Design - Mobile-friendly layout that works on all devices
git clone https://github.com/heiswayi/hnstaticgen.git
cd hnstaticgen
npm installCreate a markdown file in the content/ folder (e.g., my-first-post.md):
---
title: My First Post
description: This is my first blog post
date: "2025-01-15"
tags: ["blog", "first-post"]
draft: false
---
# Hello World!
This is my first post using **HN Static Site Generator**.# Build your site
npm run build
# Start development server
npm run serve
# Or do both with watch mode (recommended for development)
npm run devVisit http://localhost:8080 to see your site!
| Command | Description |
|---|---|
npm run build |
Build the static site |
npm run serve |
Start development server |
npm run dev |
Build, watch for changes, and serve |
npm run help |
Show help information |
Edit src/config.js to customize your site:
const config = {
blogName: "Your Blog Name",
authorName: "Your Name",
authorDescription: "A brief description about you",
authorWebsite: "https://yourwebsite.com",
blogDescription: "Your blog description",
siteUrl: "https://yourdomain.com", // Important for RSS and sitemap
dev: {
postsdir: "./content", // Where your markdown files are
outdir: "./public", // Where to generate the site
assetsdir: "./assets", // Where your images/assets are
port: 8080 // Development server port
}
};Each markdown file should start with front matter:
---
title: Post Title # Required
description: Post description # Required
date: "2025-01-15" # Required (YYYY-MM-DD format)
tags: ["tag1", "tag2"] # Optional
draft: false # Optional (default: false)
---```javascript function hello() { console.log("Hello, World!"); } ```
| Feature | Status |
|---|---|
| Tables | β |
| Tasks | β |
- Completed task
- Pending task
Text with footnote1
Press [[Ctrl]]+[[S]] to save
hnstaticgen/
βββ content/ # Your markdown posts
βββ assets/ # Images and other assets (optional)
βββ src/
β βββ cli.js # CLI interface
β βββ build.js # Build logic
β βββ config.js # Configuration
β βββ index.js # Entry point
β βββ posts.js # Post generation
β βββ homepage.js # Homepage generation
β βββ rss.js # RSS feed generation
β βββ sitemap.js # Sitemap generation
β βββ assets.js # Asset copying
β βββ serve.js # Development server
β βββ watch.js # File watching
βββ public/ # Generated site (git-ignored)
βββ package.json
npm run build
cd public
git init
git add .
git commit -m "Deploy"
git branch -M gh-pages
git remote add origin https://github.com/username/repo.git
git push -u origin gh-pages- Connect your repository to Netlify
- Set build command:
npm run build - Set publish directory:
public
npm install -g vercel
vercel --prodSee the Deployment Guide post for more options.
- Draft Posts: Set
draft: truein front matter to hide posts from publication - Tags: Add tags to organize your posts by topic
- Assets: Place images in
assets/folder and reference them in markdown - Custom Styles: Edit
public/assets/styles/main.cssto customize the design - RSS Feed: Available at
/rss.xml - Sitemap: Available at
/sitemap.xml
To modify the generator:
- Edit files in
src/directory - Run
npm run devto test changes with live reload - The site will auto-rebuild when you save changes
Contributions are welcome! Please feel free to submit a Pull Request.
Heiswayi Nrird
- Website: heiswayi.nrird.com
- GitHub: @heiswayi
MIT License - see LICENSE file for details
- Markdown parsing by markdown-it
- Syntax highlighting by highlight.js
- Markdown body styles by github-markdown-css
Made with β€οΈ using Node.js and minimal design principles
Footnotes
-
Footnote content β©