Template Repositories

The three official Notepub templates — documentation, services site and personal blog — what they share and how to keep them up to date.

Template repositories are the default way to start Notepub. Press Use this template on GitHub, turn on Pages with Source: GitHub Actions, and every push to main builds and publishes the site.

Official templates

Template Demo Repository Page types
Documentation antonlozhkin.ru/np-template-docs np-template-docs home, hub, article, page, search, footer
Services site antonlozhkin.ru/np-template-services np-template-services home, services, service, works, work, page
Personal blog antonlozhkin.ru/np-template-blog np-template-blog home (paginated feed), post, tags, page

Each one is a working site with demo content and is built with the same pinned engine release (NOTEPUB_VERSION in .github/workflows/deploy.yml). Earlier recipe repositories (notepub-recipe-blog, notepub-recipe-docs, np-obsidian-template and others) are archived. Each demo links to its repository, where Use this template starts.

Repository layout

content/        notes — one note is one page
media/          images and files, published under /media/
Site.md         site settings as note properties (title, language, logo, accent colour…)
Interface.md    interface labels as note properties
.np/            engine side: config.yaml, rules.yaml, theme/, scripts/
.github/        deploy and quality-gate workflows

The repository root is meant to be opened as an Obsidian vault: authors work in content/, media/, Site.md and Interface.md and never need .np/. Developers work in .np/ and build locally:

NOTEPUB_BIN=/path/to/notepub ./.np/scripts/preview.sh   # build and serve on http://127.0.0.1:8080/
NOTEPUB_BIN=/path/to/notepub ./.np/scripts/build.sh     # build into .np/dist/

What the build does

.np/scripts/build.sh is generated by notepub template update and is the same in all templates:

  1. turns Site.md and Interface.md into settings (prepare-settings.py; every property reaches templates as .Settings.<key>);
  2. in CI, dates every note by its last commit (the workflow checks out full history), so <lastmod> in the sitemap is the day the note changed;
  3. takes the site address from GitHub Pages (actions/configure-pages), including a custom domain, and turns http:// into https://;
  4. runs index, validate --links, validate --markdown, validate --seo, build;
  5. copies non-note files of content/ and media/ to /media/.

Shared files

tokens.css (colours, fonts, radii), fonts.css with bundled Golos Text and JetBrains Mono, main.js, partials/theme_overrides.html and everything in .np/scripts/ are identical across the three templates; only styles.css, the page templates and rules.yaml differ. theme_accent in Site.md overrides the accent colour; empty means the token.

Upgrade strategy

  • Keep content and rules as the source of truth; the theme and scripts can be replaced.
  • Raise NOTEPUB_VERSION in both workflows, then run notepub template check and notepub template update --apply to bring build.sh and deploy.yml in line with the release.
  • Read the warnings of validate --seo and validate --markdown in the Actions log after the first deploy.
  • quality-gate.yml builds the template in every compat_mode (auto|modern|legacy), with and without the settings notes, and against an S3 config.
Все результаты