A static site built with Eleventy (11ty) and Tailwind CSS, deployed to GitHub Pages via GitHub Actions.
- Node.js 20.x
- npm 9+
# Install dependencies
npm ci
# Start local dev server (watches templates and CSS)
npm run dev
# Build production site to `_site/`
npm run build
src/
— Eleventy input directory_includes/
— Nunjucks layouts, partials, and componentslayouts/base.njk
— base layout wrapperlayouts/product.njk
— product page layoutcomponents/product-card.njk
— product card markup
_data/
— site datasite.json
— defaults (name, url, etc.)site.js
— readsSITE_URL
env at build time
content/
— markdown contentproducts/*.md
— product entries (front matter defines price, images, etc.)
images/
— source images used by shortcodesindex.njk
,shop.njk
,404.njk
, etc.
public/
— passthrough to the site root (robots.txt, CNAME if using a custom domain)_site/
— build output (generated)
- Tailwind configured in
tailwind.config.js
postcss
buildssrc/styles/input.css
→_site/assets/main.css
- Image shortcode is defined in
.eleventy.js
using@11ty/eleventy-img
. - If the native image pipeline (sharp) is unavailable, it gracefully falls back to a plain
<img>
tag.
Note: src/content/products/ode-to-you-book.md
references src/images/products/ode-to-you/odetoyou.jpg
. If this file is missing, the build falls back to the SVGs in that folder.
This repo uses an Actions workflow at .github/workflows/pages.yml
.
One-time repo settings:
- Settings → Pages → Build and deployment → Source: select “GitHub Actions”.
- Settings → Actions → General → Workflow permissions: “Read and write permissions”.
How the workflow works:
- Installs dependencies and runs
npm run build
. - Writes output to
_site/
and uploads it as the Pages artifact. - Adds
.nojekyll
so GitHub Pages does not try to Jekyll‑render the output. - Sets two environment variables used by the build:
PATH_PREFIX
→/${repo}
for correct absolute URLs when the site is published at/username/repo
.SITE_URL
→ used bysrc/_data/site.js
to compute canonical URLs.
After pushing to master
, GitHub Actions will build and deploy automatically.
- Red job named “pages build and deployment / build (dynamic)” fails with Liquid errors
- Switch Settings → Pages → Source to “GitHub Actions”. That removes the legacy Jekyll job (Jekyll tries to parse Nunjucks templates and fails on tags like
productcard
).
- Switch Settings → Pages → Source to “GitHub Actions”. That removes the legacy Jekyll job (Jekyll tries to parse Nunjucks templates and fails on tags like
- Broken image URLs
- Ensure paths in front matter (e.g.,
/images/...
) point to files undersrc/images/...
. The image shortcode strips the leading slash and looks undersrc/
.
- Ensure paths in front matter (e.g.,
- Paths look wrong in production
- Confirm
PATH_PREFIX
andSITE_URL
variables are set by the workflow (they are in the provided workflow).
- Confirm
Add a CNAME
file under public/
with your domain name. It will be copied to the site root on build.
npm run dev
— concurrently runs Eleventy dev server and PostCSS watchernpm run build
— cleans_site/
, builds CSS and templates for production
Not specified. Add your preferred license file if needed.