Files
unprompted/drafts/drafts.11tydata.js
Stephen Donahue c6d7c8c211
Some checks failed
Deploy to S3 / deploy (push) Failing after 1m24s
Swap published columns for 24 entries from random.md
Retract the seven published columns into drafts/ and promote the 24 per-date
entries split out of Notes/random.md. Bodies are verbatim; titles, subjects
and slugs are new.

Make publication a matter of location. Notes/Notes.11tydata.js gives anything
under Notes/ permalink: false unless tagged `column`; drafts/drafts.11tydata.js
renders drafts at their real permalink under `yarn dev` and excludes them from
collections entirely in a build, so no template can surface one. Publishing is
now `git mv drafts/<file> columns/`, and moving it back retracts it.

Untagged notes were previously rendered into _site/ and deployed — including
Notes/random.md, which was live at /Notes/random/.
2026-08-02 22:45:19 +00:00

36 lines
1.8 KiB
JavaScript

// Drafts are visible on the dev server and nowhere else.
//
// ELEVENTY_RUN_MODE is "serve" or "watch" under `yarn dev`, and "build" under
// `yarn build` — which is the only thing CI and the Dockerfile ever run. So the
// gate fails safe: a draft can be previewed at its real permalink locally, but
// no code path that produces a deployable _site/ will emit one.
//
// Collection membership is itself gated on the run mode, and that is the hard
// guarantee rather than a courtesy:
//
// build — a draft belongs to NO collection, so no template can render its
// title, date, or URL even by accident. Eleventy auto-creates a
// collection per tag, and drafts carry `tags: [column, <subject>]`
// so that promoting one is a plain `git mv`. That means they land
// in collections.philosophy and friends, which /subjects/ iterates
// directly — it listed every draft with href="false" until this
// gate existed. Filtering the two hand-written collections was not
// enough; only excluding them wholesale is.
// serve — a draft joins collections so /drafts/ can enumerate them. The
// `draft` flag then keeps them out of the homepage and the sidebar
// (see .eleventy.js) and out of /subjects/ (see subjects.njk), so
// every page except /drafts/ shows exactly what production shows.
//
// Promoting a draft is `git mv drafts/x.md columns/`: the front matter is
// already complete and correct, and leaving this directory is what publishes it.
const PREVIEW = process.env.ELEVENTY_RUN_MODE !== "build";
module.exports = {
draft: true,
eleventyExcludeFromCollections: !PREVIEW,
eleventyComputed: {
permalink: (data) => (PREVIEW ? data.permalink : false),
},
};