User guide · Plain HTML

Plain HTML sites

stet works on a site that's only HTML files, with no framework and no build step. Your pages keep their words. stet marks each element it manages and keeps every word in content/defaults.json, so you change the copy in one place and your pages follow.

You need Node 22 or newer, the site in git, and a package.json at its root. npm init -y makes one if you don't have it.

01Run init

init sees HTML pages and no framework, and sets the site up as an HTML host. It writes the content registry, the committed copy and the config, and adds no code to your pages.

$ npm install -D @getstet/stet
$ npx stet init
host: html (… no framework in package.json)
wrote content/descriptor.json
wrote content/defaults.json
wrote stet.config.json
…
2 pages, 11 text elements, 2 attributes

02Mark your copy

scan lists the words on every page, including page titles, meta descriptions and image alt text. register shows the mark it will add to each element. Nothing is written until you add --write.

A sentence with markup inside it stays one key: Orders over <1>£30</1> ship free. keeps its <strong> as a numbered tag. Text that appears on several pages, like a footer line, shares one key.

$ npx stet scan
scan: 2 files, 13 unkeyed literals

$ npx stet register --from scan
- <h1>Roasted this week.</h1>
+ <h1 data-stet="home_headline">Roasted this week.</h1>
…
register: run with --write to apply 13 marks across 2 documents

$ npx stet register --from scan --write
wrote … 2 documents: 12 keys added, 1 shared

03Change the words

Edit the value in content/defaults.json and run stet pull. It rewrites every marked element that shows the key, on every page. The dashboard does the same with a preview.

Commit, and your deploy puts the new words live.

# content/defaults.json
"home_headline": "Fresh from Tuesday’s roast."

$ npx stet pull
wrote index.html
- <h1 …>Roasted this week.</h1>
+ <h1 …>Fresh from Tuesday’s roast.</h1>

04Edits by hand get caught

If someone changes a marked element in the HTML directly, check names it and says how to settle it: pull the committed copy back, or put the new text in defaults.json to keep it. With stet hook install, the same check runs before every commit and stops the commit until it's settled.

$ npx stet check
error: index.html:14 home_shop_link differs from the snapshot
  run stet pull to apply the snapshot, or edit the
  snapshot to keep the page's text

05Titles and descriptions

pages scan --apply declares each page and binds its title and meta description to the keys already marked on it, so seo check can check them.

A description that repeats a sentence from the page follows it. register builds it from that sentence, so changing the sentence updates both.

$ npx stet pages scan --apply
home (/)
  title: bound to home_title
  description: bound to home_description
about (/about)
  title: bound to about_title

06Leaving

eject takes every mark out of your pages and leaves the text exactly as it reads now. It prints its plan first, and --write applies it.

$ npx stet eject
document: about.html — every mark removed, the text stays
document: index.html — every mark removed, the text stays

$ npx stet eject --write