Organize columns by subject tags; add /subjects/ page
All checks were successful
Deploy to S3 / deploy (push) Successful in 49s
All checks were successful
Deploy to S3 / deploy (push) Successful in 49s
- Drive the columns collection from the `column` tag, recovering 3 columns authored under Notes/ that the glob missed - Tag the 6 columns with subject tags; add a subjects collection and a /subjects/ listing page (newest-first), linked from the footer
This commit is contained in:
17
.eleventy.js
17
.eleventy.js
@@ -69,12 +69,27 @@ 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.
|
||||
eleventyConfig.addCollection("columns", function (collectionApi) {
|
||||
return collectionApi
|
||||
.getFilteredByGlob("columns/**/*.md")
|
||||
.getFilteredByTag("column")
|
||||
.sort((a, b) => b.date - a.date);
|
||||
});
|
||||
|
||||
// The subject tags actually in use across columns — everything except the
|
||||
// `column` type marker and Eleventy's reserved `all`. Sorted for stable order.
|
||||
eleventyConfig.addCollection("subjects", function (collectionApi) {
|
||||
const reserved = new Set(["all", "column"]);
|
||||
const subjects = new Set();
|
||||
for (const item of collectionApi.getFilteredByTag("column")) {
|
||||
for (const tag of item.data.tags || []) {
|
||||
if (!reserved.has(tag)) subjects.add(tag);
|
||||
}
|
||||
}
|
||||
return [...subjects].sort();
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("inlineMarkdown", function (text) {
|
||||
return text.replace(/~~(.+?)~~/g, "<del>$1</del>");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user