Skip to content
PeaBox-LabPublic

About

Website generator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PeaPress

A simple static site generator, inspired by Grav, Astro and Eleventy.

PeaPress takes Markdown files with YAML frontmatter as content, renders them through Nunjucks templates with layouts, and outputs clean static HTML into dist/.

Features

  • 📝 Markdown content with YAML frontmatter (title, date, slug, tags, …)
  • 🧩 Nunjucks templates with layout inheritance ({% extends %})
  • 📚 Collections — group posts by frontmatter or directory (e.g. /blog/)
  • ⚡ Clean static output with pretty URLs (/blog/hello-world/ → dist/blog/hello-world/index.html)
  • 🔁 Watch mode with dev server
  • 🎨 Static asset copying (static/ or src/assets/)

Quick Start

# Install dependencies
npm install

# Build the site
node peapress.js build

# Or use the npm scripts
npm run build

# Watch + dev server
node peapress.js dev

The generated site is in dist/. Any static host (Netlify, Vercel, GitHub Pages, S3, Apache, nginx…) can serve it.

Usage

Content

Create Markdown files anywhere under src/ (or content/, pages/, posts/):

---
title: My Post
date: 2026-01-15
slug: /blog/my-post/
collection: posts
tags: [demo]
---

# Hello

Write **Markdown** here. HTML is allowed too.
  • slug / url / permalink control the output URL.
  • collection groups content (defaults to the parent folder name).
  • Listing pages use template: list and iterate over a collection.

Templates

Templates live in templates/ and use Nunjucks. base.njk is the HTML shell with {% block content %} etc. Page templates extend it:

{% extends "base.njk" %}
{% block content %}
  {{ content | safe }}
{% endblock %}

Set layout or template in frontmatter to pick a template:

  • layout: post → uses templates/post.njk
  • template: list → uses templates/list.njk

Site data

Add JSON/YAML data files in src/_data/:

  • src/_data/site.json → global site data (site.title, site.author, …)
  • Any other file groups data by name (e.g. _data/blog.json → blog).

Project Structure

peapress.js          # CLI entry
lib/
  builder.js         # scan → parse → render → write
  parser.js          # frontmatter + markdown
  renderer.js        # nunjucks rendering
  config.js          # site configuration
  dev-server.js     # watch + serve
templates/           # nunjucks templates
src/                 # content + _data
  index.md
  about.md
  blog/
  _data/site.json
static/              # static assets (css, images…)
dist/                # generated output (gitignored)

CLI

peapress build [dir]     # build the site
peapress dev [dir]       # watch + dev server on :8080
peapress new <name> [collection]  # scaffold a new content file
peapress --help

About

Website generator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages