A static site powered by Eleventy (11ty), with a modular helper system for collections, layouts, filters, shortcodes, and a modern CSS pipeline.
Requirements:
- Node.js v24+ (managed via Volta if desired)
- npm
Install dependencies:
npm installRun the development server:
npm startThis starts Eleventy in serve mode with incremental builds.
Build for production:
npm run buildOutputs the static site to the dist/ directory.
Clean build artifacts:
npm run cleansrc/content/— Markdown and content filessrc/layouts/— Nunjucks layout templatessrc/styles/— CSS (processed with PostCSS)src/helpers/— Modular helper scripts for Eleventy configeleventy.config.js— Main Eleventy configuration
The site is built with Eleventy and outputs to the dist/ directory. Deployment is automated using GitHub Actions:
- Automatic Deployments:
- On every push to the
mainbranch, the workflow in.github/workflows/build-and-deploy.ymlruns:- Checks out the code and sets up Node.js (v24.2.0).
- Installs dependencies with
npm ci. - Builds the site with
npm run build. - Deploys the contents of the
dist/directory to thegh-pagesbranch using thepeaceiris/actions-gh-pagesaction and a deploy key stored in repository secrets.
- On every push to the
- Custom Domain:
- The
CNAMEfile insrc/is copied to the root of the deployed site for custom domain support.
- The
- Preview Builds:
- On pull requests to
main, the workflow in.github/workflows/build.ymlruns a build to ensure the site compiles, but does not deploy.
- On pull requests to
You do not need to manually deploy; simply push to main and the site will be published automatically.
Helpers in src/helpers/ modularize Eleventy’s configuration:
- setup-plugins.js: Register Eleventy plugins (extend as needed).
- setup-css.js: Handles CSS build pipeline using PostCSS, autoprefixer, nesting, and minification. Watches for changes in development.
- setup-passthrough.js: Configures passthrough copy for static assets (e.g.,
CNAME). - setup-global-data.js: Adds global data and computed values (e.g., permalinks, grouped archives).
- setup-layout-aliases.js: Registers layout aliases for all Nunjucks templates in
src/layouts/. - setup-shortcodes.js: Registers custom shortcodes (e.g.,
imageShortcodefor progressive images). - setup-filters.js: Registers custom Nunjucks/Eleventy filters (e.g.,
groupByYear). - group-by-year.js: Groups content entries by year for archive views.
- compute-permalinks.js: Computes clean permalinks for content.
- collections-config.js: Central config for custom collections (notes, projects, recipes, etc.).
- setup-collections.js: Registers custom collections based on
collections-config.js. - setup-eleventy-before.js: Adds Eleventy event hooks (e.g., debugging layouts).
- image-shortcode.js: Shortcode for responsive/progressive images.
- Debugging Layouts:
SetDEBUG_LAYOUTS=trueorDEBUG_LAYOUT_ALIASES=truein your environment to log layout and alias registration. - CSS Issues:
The CSS pipeline uses PostCSS. If styles are missing, check the build output and ensure all PostCSS plugins are installed. - Permalinks:
If permalinks are not as expected, reviewcompute-permalinks.jsand the computed data insetup-global-data.js. - Collections:
Custom collections are defined incollections-config.jsand registered insetup-collections.js. Check these files if content is missing from expected collections. - Static Assets:
Only specific files (likeCNAME) are passed through by default. Add more passthroughs insetup-passthrough.jsas needed.