The Batchelder family cookbook: mattbat.com/cookbook.
Every recipe is a markdown file in _recipes/. Add or change one on master and the site
rebuilds, tests itself, and publishes on its own.
- Copy
_recipes/_template/template.mdto_recipes/my-new-recipe.md(lowercase, with hyphens: the file name becomes the web address). - Put the photo in
img/and point to it:. - Fill in the details at the top (
author,servings,tags, ...) and the recipe itself: one# Title, then## Ingredientsas a-list and## Stepsas a1.list (see below). - Commit to
master, either from your computer or with Add file on github.com.
Recipes are plain markdown so they stay usable whatever the website becomes. Keep them consistent:
- Top block (front matter)
date: the day it was added,YYYY-MM-DDprep_time,cooking_time: whole minutes (90, not1.5 hr)servings: a number; addservingsUnit: Cups(or Pints, Cookies…) when it isn't peopleauthor: who makes it in the family;source: where it came from, as a name;sourceUrl: a link to the originaltags: lowercase, from the list intests/content/recipes.test.mjs(add new ones there)
- Sections:
## Ingredients,## Steps,## Notes, and when needed## Tools(equipment) and## Videos(- Cook: <https://…>). Sub-groups go under### Crust,### Filling… - Ingredients:
- amount unit item, prep (note), e.g.- 1½ cups red onion, finely chopped- Units:
tsp,Tbsp,cup/cups,oz,lb, with a space after the number - Fractions as
½ ¼ ¾ ⅓ ⅔ ⅛(1½, not1 1/2) - Ranges as
2 to 3, so the serving-size buttons scale both numbers - Equipment goes in
## Tools, not the ingredient list (it would be scaled)
- Units:
- Steps: a
1.list with one line per step and no blank lines between steps - Notes: a
-list - Temperatures as
350°F(the degree sign °, not º)
npm run test:unit checks most of this and says exactly what to fix.
The repo includes a Claude Code skill (.claude/skills/add-recipe/) that does all of the above.
Give it a photo of a recipe card or cookbook page, a website link, or pasted text, for example:
add this recipe to the cookbook: https://www.kingarthurbaking.com/recipes/classic-sandwich-bread-recipe
add grandma's card to the cookbook, by Tracy Batchelder [photo]
It reads the recipe, writes _recipes/<name>.md in the house style (rewording the steps rather
than copying a website), saves the photo, runs the recipe checks, and opens a pull request.
Merging the pull request publishes it. It tells you what it guessed (times, tags) so you can
correct it in the same chat.
- On your phone: in the Claude app, start a Code session on the
mattbat/cookbookrepository (Claude Code on the web) and ask as above. To import from websites there, the environment needs internet access to those sites; if a page won't load, paste the recipe text or a screenshot. - On your computer: run
claudein this folder, or use the Claude desktop app, and ask the same way. - Photos: a website's photo isn't used unless you ask ("use the website's photo"), since the
cookbook is public. Without a photo of the dish, it adds a plain placeholder; replace
img/<name>.jpegwith your own photo any time.
Or let the tools write the file for you:
npm run new "Grandma's Pot Roast"npm run import https://example.com/some-recipe(import needs a Spoonacular API key: copy
CLI/CREDENTIALS.example.json to CLI/CREDENTIALS.json and add your key.)
You need Node.js 22 or newer. Once, after cloning:
npm installnpx playwright install chromium webkitThen:
| Command | What it does |
|---|---|
npm start |
Builds the site and serves it at http://localhost:8080/cookbook/, rebuilding as you save |
npm test |
Everything below, in order (what GitHub runs before publishing) |
npm run test:unit |
Checks every recipe file, and the serving-size math (a couple of seconds) |
npm run build |
Builds the site into _site/ |
npm run test:build |
Checks the built site: every old address still works, no broken links or photos |
npm run test:e2e |
Clicks through the site on an iPhone, an Android phone and a desktop browser |
npm run test:e2e:ui |
Same, in a window where you can watch each test and step through it |
If npm start is already running, the browser tests use it instead of starting their own server.
After a failed browser test, npx playwright show-report shows screenshots and a step-by-step trace.
On Windows PowerShell, type npm.cmd instead of npm if PowerShell says running scripts is disabled.
To try the site on your phone, run npm start, connect the phone to the same Wi-Fi, and open
http://<your computer's IP address>:8080/cookbook/ (ipconfig shows the address).
Bugs we know about have tests marked test.fail (browser tests) or todo (unit tests). They
pass today because the bug is still there. When a fix lands, that test starts complaining
("expected to fail, but passed"); remove the marker so it guards the fix from then on.
.github/workflows/site.yml runs on every push to master, on pull requests, and on demand
from the Actions tab:
- Checks every recipe file and the scaling math
- Builds the site with Eleventy
- Checks the built site (addresses, links, photos)
- Runs the browser tests
- Publishes to GitHub Pages, but only from
masterand only if everything above passed
If anything fails, the live site stays as it was, GitHub emails you, and the run's page shows
the exact problem (for example gumbo.md: img/gumbo.jpg not found).
Until this is done, GitHub's old built-in Jekyll build is still what publishes the site.
- Settings → Pages → Build and deployment → Source: choose GitHub Actions. The current site stays up until the next publish.
- Settings → Secrets and variables → Actions → Variables: add
PAGES_DEPLOY=actions. - Merge to
master(or run the workflow from the Actions tab).
Built with Eleventy, searched with MiniSearch,
tested with Playwright and Node's built-in test runner, and hosted on
GitHub Pages. No CSS or JavaScript framework: the look is in css/site.css, page behaviour in
js/:
| File | Where | What |
|---|---|---|
app.js |
every page | tap a step to keep your place; shared helpers |
timers.js |
every page | times in the steps ("simmer 30-40 minutes") become timer buttons; running timers follow you between pages |
search.js |
Search tab | search and category filters |
recipe-scaling.js |
recipes | the servings stepper (and metric amounts in the ingredients) |
units.js |
recipes | the US / Metric switch: dry ingredients in cups are weighed (g), liquids in mL, °C and cm; teaspoons and tablespoons stay as written |
kitchen.js |
recipes | ingredient check-offs, Copy list, Share, Keep screen on, Cook mode |
offline.js |
offline page | lists the recipes saved on this device |
Every recipe page also carries schema.org Recipe data (built by
recipeJsonLd in lib/recipes.js), so Google and recipe apps can read the ingredients, steps
and times. Steps are the numbered lists under a ## Steps heading (### sub-headings inside it
are fine); Notes lists aren't steps.
Keep screen on, the share sheet and the clipboard need a secure (https) page, so when you test on
your phone at http://<your IP>:8080 the Keep screen on button is hidden and Share copies the link
instead. On the live site they all work.
- Add to Home Screen makes the cookbook open full screen with its own icon (
manifest.webmanifest.njk; the icon is drawn inlib/icons.jsand saved as PNGs during the build). The home page shows a card explaining how, until it's installed or dismissed. - Offline:
sw.js.njkis a service worker that saves the site on the phone. Pages are always fetched fresh when there's signal (after 4 seconds on a weak signal, the saved copy is used); recipes you've opened before work with no signal at all, and other pages show/offline/, which lists the saved recipes. It needs https, so it doesn't run when testing on a phone overhttp://. - Photos:
lib/photos.jsmakes smaller copies of every photo inimg/(240 to 1600 pixels wide, inimg/w/), and pages usesrcsetso phones download one about the size of their screen. Copies are kept in.cache/photosso only new or changed photos are resized; the first build after cloning takes about 30 seconds longer. Keep adding full-size photos toimg/as before.
If npm start is running, stop it before npm test: both write to _site/. Restart npm start
after changing eleventy.config.mjs, lib/ or _data/, which it doesn't reload on its own.
The site's sections (the bottom tabs on phones, the top links on desktop) and the category list
are set in _data/site.json. A category only appears once at least one recipe has its tag.
Originally based on jansim/cookbook and the beautiful-jekyll theme by Dean Attali.