Duplication
Edit a block once, for example the site footer, and have it copied, verbatim, onto every page that references it. One master, many copies, kept in step on every run.
Master
On one page, wrap the canonical block in a duplicate master. This is the only copy
you edit:
<!-- localhoster:duplicate name="footer" role="master"
NOTE: Master copy of the site footer — edit here.
See: https://localhoster.org/automation/duplication/ -->
<footer>
… your footer …
</footer>
<!-- localhoster:/duplicate name="footer" -->
Note: the notes are free text to remind editors about
the structure.
Copies
On every other page, the same markers with role="copy". Whatever sits between them
is replaced with the master’s content on the next run, and the note points back to where the
master lives:
<!-- localhoster:duplicate name="footer" role="copy"
NOTE: Generated — edit the master at: /index.html
See: https://localhoster.org/automation/duplication/ -->
<footer>
… replaced from the master …
</footer>
<!-- localhoster:/duplicate name="footer" -->
The name is what ties a master to its copies, use different names for independent
blocks (a footer, a banner, a sign-up box). There must be exactly one master per name within a
site, and a copy with no master is an error.
Propagate the master to every copy with
node client/automate.js (add --dry-run -v to preview).