Swap published columns for 24 entries from random.md
Some checks failed
Deploy to S3 / deploy (push) Failing after 1m24s
Some checks failed
Deploy to S3 / deploy (push) Failing after 1m24s
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/.
This commit is contained in:
22
.eleventy.js
22
.eleventy.js
@@ -75,11 +75,28 @@ module.exports = function (eleventyConfig) {
|
||||
eleventyConfig.addShortcode("image", imageShortcode);
|
||||
eleventyConfig.addShortcode("heroImage", heroImageShortcode);
|
||||
|
||||
// A "column" is anything tagged `column`, wherever it lives on disk
|
||||
// (some columns are authored under Notes/). Newest first.
|
||||
// A "column" is anything tagged `column`, wherever it lives on disk.
|
||||
// Newest first.
|
||||
//
|
||||
// Drafts carry the `column` tag too — their front matter is complete so that
|
||||
// promoting one is a plain `git mv` — so they must be filtered out here by
|
||||
// the `draft` flag that drafts/drafts.11tydata.js sets. This collection
|
||||
// feeds the homepage and the sidebar archive; a draft in it would be listed
|
||||
// sitewide.
|
||||
eleventyConfig.addCollection("columns", function (collectionApi) {
|
||||
return collectionApi
|
||||
.getFilteredByTag("column")
|
||||
.filter((item) => !item.data.draft)
|
||||
.sort((a, b) => b.date - a.date);
|
||||
});
|
||||
|
||||
// Drafts, newest first, for the /drafts/ index. The collection is populated
|
||||
// in both run modes, but the only page that reads it lives under drafts/ and
|
||||
// so is itself unwritten during `yarn build`.
|
||||
eleventyConfig.addCollection("drafts", function (collectionApi) {
|
||||
return collectionApi
|
||||
.getAll()
|
||||
.filter((item) => item.data.draft)
|
||||
.sort((a, b) => b.date - a.date);
|
||||
});
|
||||
|
||||
@@ -89,6 +106,7 @@ module.exports = function (eleventyConfig) {
|
||||
const reserved = new Set(["all", "column"]);
|
||||
const subjects = new Set();
|
||||
for (const item of collectionApi.getFilteredByTag("column")) {
|
||||
if (item.data.draft) continue;
|
||||
for (const tag of item.data.tags || []) {
|
||||
if (!reserved.has(tag)) subjects.add(tag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user