feat: archive page

This commit is contained in:
venus
2026-10-27 17:33:34 -05:00
parent 59f807c45b
commit 0967d540cf
5 changed files with 327 additions and 4 deletions
+16 -2
View File
@@ -2,7 +2,13 @@ import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import markdownIt from "markdown-it";
import markdownItAnchor from "markdown-it-anchor";
import { filters } from "./src/_filters/index.js";
import { postComparator, isPostPublic } from "./src/_utils/sort-posts.js";
import {
postComparator,
isPostPublic,
isPostArchived,
isPostDraft,
isPostHidden
} from "./src/_utils/sort-posts.js";
import { validateLinkedArticles } from "./src/_utils/linked-articles.js";
export default function (eleventyConfig) {
@@ -49,7 +55,7 @@ export default function (eleventyConfig) {
}
// 5. Custom Collections
// Pinned / featured prioritized, chronological blog posts collection (excludes drafts and hidden posts)
// Pinned / featured prioritized, chronological blog posts collection (excludes drafts, hidden, and archived posts)
eleventyConfig.addCollection("posts", (collectionApi) => {
const allPosts = collectionApi.getFilteredByGlob("src/posts/*.md");
validateLinkedArticles(allPosts);
@@ -59,6 +65,14 @@ export default function (eleventyConfig) {
.sort(postComparator);
});
// Chronological archived blog posts collection (excludes drafts and hidden posts)
eleventyConfig.addCollection("archivedPosts", (collectionApi) => {
return collectionApi
.getFilteredByGlob("src/posts/*.md")
.filter((post) => !isPostDraft(post) && !isPostHidden(post) && isPostArchived(post))
.sort(postComparator);
});
// Dynamic Tag List Collection across all public posts (excludes drafts and hidden posts)
eleventyConfig.addCollection("tagList", (collectionApi) => {
const tagSet = new Set();