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>");
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Do ~~Machines~~ People Think?
|
||||
date: 2026-04-02
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, philosophy]
|
||||
permalink: /columns/2026/do-people-think/
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: How To Write
|
||||
date: 2026-04-06
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, writing]
|
||||
permalink: /columns/2026/how-to-write/
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: systems
|
||||
date: 2026-04-06
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, philosophy]
|
||||
permalink: /columns/2026/systems/
|
||||
---
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<nav class="footer-nav">
|
||||
<a href="/about/">about</a>
|
||||
<a href="/code/">code</a>
|
||||
<a href="/subjects/">subjects</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<nav class="footer-nav">
|
||||
<a href="/about/">about</a>
|
||||
<a href="/code/">code</a>
|
||||
<a href="/subjects/">subjects</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Happy Idiots
|
||||
date: 2026-04-19
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, society]
|
||||
permalink: /columns/2026/happy-idiots/
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: 12-Watt Bulbs
|
||||
date: 2026-05-14
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, society]
|
||||
permalink: /columns/2026/thrilling/
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Hamming It Up
|
||||
date: 2026-06-23
|
||||
layout: column.njk
|
||||
tags: column
|
||||
tags: [column, computing]
|
||||
permalink: /columns/2026/hamming/
|
||||
---
|
||||
|
||||
|
||||
@@ -175,6 +175,33 @@ a:hover {
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
/* subjects index */
|
||||
|
||||
.subject-group {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.subject-group h2 {
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.subject-group ul {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.subject-group li {
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
|
||||
.subject-group time {
|
||||
font-family: var(--font-ui);
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-muted);
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
/* sidebar */
|
||||
|
||||
.sidebar {
|
||||
|
||||
23
subjects.njk
Normal file
23
subjects.njk
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
layout: base.njk
|
||||
title: Subjects
|
||||
permalink: /subjects/
|
||||
---
|
||||
|
||||
<h1>Subjects</h1>
|
||||
|
||||
{%- for subject in collections.subjects %}
|
||||
<section class="subject-group">
|
||||
<h2>{{ subject }}</h2>
|
||||
<ul>
|
||||
{%- for post in collections[subject] | sort(true, false, "date") %}
|
||||
<li>
|
||||
<a href="{{ post.url }}">{{ post.data.title | inlineMarkdown | safe }}</a>
|
||||
<time datetime="{{ post.date | isoDate }}">{{ post.date | readableDate }}</time>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{%- else %}
|
||||
<p>No subjects yet.</p>
|
||||
{%- endfor %}
|
||||
Reference in New Issue
Block a user