jsonblog-generator-boilerplate v1.7.0
JsonBlog Generator Boilerplate
A modern, customizable static blog generator that serves as a reference implementation for JsonBlog. This package is used by jsonblog-cli to generate clean, modern HTML output.
Want to create your own blog theme? Fork this repository and customize it! This boilerplate is designed to be a starting point for your own generator. See the Creating Your Own Generator section below.
Features
- Clean, modern HTML output
- Markdown support with code highlighting
- Customizable templates using Handlebars
- TypeScript support
- Well-documented API
- Extensive test coverage
- Perfect starting point for your own generator
Installation
npm install jsonblog-generator-boilerplateUsage
import { generator } from 'jsonblog-generator-boilerplate';
const blog = {
site: {
title: 'My Blog',
description: 'A blog about my thoughts',
},
basics: {
name: 'John Doe',
},
posts: [
{
title: 'Hello World',
content: '# My First Post\n\nWelcome to my blog!',
createdAt: '2025-02-25',
},
],
};
const files = await generator(blog, './output');Development
Prerequisites
- Node.js >= 20.0.0
- npm
Setup
# Clone the repository
git clone https://github.com/jsonblog/jsonblog-generator-boilerplate.git
cd jsonblog-generator-boilerplate
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm testAvailable Scripts
npm run build- Build the TypeScript codenpm test- Run testsnpm run lint- Run ESLintnpm run format- Format code with Prettier
Release Process
- Make your changes
- Run tests and linting:
npm test && npm run lint - Use one of the following commands to create a new version:
npm run release:patch- Bug fixes (1.0.0 -> 1.0.1)npm run release:minor- New features (1.0.0 -> 1.1.0)npm run release:major- Breaking changes (1.0.0 -> 2.0.0)
- Create a new release on GitHub to trigger the publishing workflow
Creating Your Own Generator
This boilerplate is designed to be forked and customized. Here's how to create your own generator:
Quick Start
- Fork this repository
- Update package.json with your generator name (e.g.,
jsonblog-generator-yourname) - Customize the templates in
templates/ - Modify the styles in
assets/main.css - Test your changes with the provided test suite
- Publish to npm!
What to Customize
templates/layout.hbs: Main layout template with HTML structuretemplates/index.hbs: Blog index page templatetemplates/post.hbs: Individual post templateassets/main.css: Your custom stylessrc/index.ts: Generator logic (if needed)
Generator API
Your generator only needs to implement one function:
async function generator(blog: BlogConfig, outputPath: string): Promise<GeneratedFile[]>;The boilerplate handles:
- Markdown rendering
- File management
- Template processing
- Content fetching (local, remote, IPFS)
You just focus on making it look great!
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Related Projects
- jsonblog-cli - Command-line interface that uses this generator
License
This project is licensed under the MIT License - see the LICENSE file for details.
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago