upgrade to 3.0

This commit is contained in:
Kathleen Fitzpatrick
2024-10-14 19:27:15 -04:00
parent e8f8a543de
commit 655ad0ded8
1988 changed files with 47081 additions and 263 deletions

View File

@@ -6,6 +6,9 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
import pluginFilters from "./_config/filters.js";
import * as _ from "lodash-es";
const publishedContent = (item) => !item.data.draft;
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function(eleventyConfig) {
// Drafts, see also _data/eleventyDataSchema.js
@@ -23,6 +26,17 @@ export default async function(eleventyConfig) {
})
.addPassthroughCopy("./content/feed/pretty-atom-feed.xsl");
// Create posts by year collection
eleventyConfig.addCollection("postsByYear", async (collectionsApi) => {
return _.chain(collectionsApi.getAllSorted())
.filter(item => item.inputPath.startsWith('./content/blog/'))
.filter(publishedContent)
.groupBy((post) => post.date.getFullYear())
.toPairs()
.reverse()
.value();
});
// Run Eleventy when these files change:
// https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets
@@ -63,11 +77,11 @@ export default async function(eleventyConfig) {
},
metadata: {
language: "en",
title: "Blog Title",
subtitle: "This is a longer description about your blog.",
base: "https://example.com/",
title: "kfitz",
subtitle: "The long-running and erratically updated blog of Kathleen Fitzpatrick.",
base: "https://kfitz.info/",
author: {
name: "Your Name"
name: "Kathleen Fitzpatrick"
}
}
});
@@ -78,9 +92,11 @@ export default async function(eleventyConfig) {
extensions: "html",
// Output formats for each image.
formats: ["avif", "webp", "auto"],
formats: ["jpeg", "png"],
// widths: ["auto"],
widths: ["600"],
urlPath: "/img/",
defaultAttributes: {
// e.g. <img loading decoding> assigned on the HTML tag will override these values.