|
|
|
@ -16,7 +16,7 @@ import pluginDrafts from "./eleventy.config.drafts.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
|
|
|
|
|
export default async function (eleventyConfig) {
|
|
|
|
|
export default async function(eleventyConfig) {
|
|
|
|
|
// Copy the contents of the `public` folder to the output folder
|
|
|
|
|
// For example, `./public/css/` ends up in `_site/css/`
|
|
|
|
|
eleventyConfig.addPassthroughCopy({
|
|
|
|
@ -27,9 +27,6 @@ export default async function (eleventyConfig) {
|
|
|
|
|
"./node_modules/reveal.js/plugin/": "/revealjs-plugins/",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Run Eleventy when these files change:
|
|
|
|
|
// https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets
|
|
|
|
|
|
|
|
|
|
// Watch content images for the image pipeline.
|
|
|
|
|
eleventyConfig.addWatchTarget("content/**/*.{svg,webp,png,jpeg}");
|
|
|
|
|
|
|
|
|
@ -67,8 +64,8 @@ export default async function (eleventyConfig) {
|
|
|
|
|
eleventyConfig.addPlugin(pluginBundle);
|
|
|
|
|
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
|
|
|
|
|
extensions: "html",
|
|
|
|
|
formats: [ "webp", "jpeg", null ],
|
|
|
|
|
widths: [ 400, 800, 1280, null ],
|
|
|
|
|
formats: ["webp", "jpeg", null],
|
|
|
|
|
widths: [400, 800, 1280, null],
|
|
|
|
|
defaultAttributes: {
|
|
|
|
|
loading: "lazy",
|
|
|
|
|
decoding: "async",
|
|
|
|
@ -86,15 +83,15 @@ export default async function (eleventyConfig) {
|
|
|
|
|
|
|
|
|
|
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
|
|
|
|
|
// dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
|
|
|
|
|
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
|
|
|
|
|
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Get the first `n` elements of a collection.
|
|
|
|
|
eleventyConfig.addFilter("head", (array, n) => {
|
|
|
|
|
if(!Array.isArray(array) || array.length === 0) {
|
|
|
|
|
if (!Array.isArray(array) || array.length === 0) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
if( n < 0 ) {
|
|
|
|
|
if (n < 0) {
|
|
|
|
|
return array.slice(n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -109,7 +106,7 @@ export default async function (eleventyConfig) {
|
|
|
|
|
// Return all the tags used in a collection
|
|
|
|
|
eleventyConfig.addFilter("getAllTags", collection => {
|
|
|
|
|
let tagSet = new Set();
|
|
|
|
|
for(let item of collection) {
|
|
|
|
|
for (let item of collection) {
|
|
|
|
|
(item.data.tags || []).forEach(tag => tagSet.add(tag));
|
|
|
|
|
}
|
|
|
|
|
return Array.from(tagSet);
|
|
|
|
@ -131,7 +128,7 @@ export default async function (eleventyConfig) {
|
|
|
|
|
symbol: "@",
|
|
|
|
|
ariaHidden: false,
|
|
|
|
|
}),
|
|
|
|
|
level: [1,2,3,4],
|
|
|
|
|
level: [1, 2, 3, 4],
|
|
|
|
|
slugify: eleventyConfig.getFilter("slugify")
|
|
|
|
|
});
|
|
|
|
|
mdLib.use(markdownItAbbr);
|
|
|
|
@ -146,13 +143,16 @@ export default async function (eleventyConfig) {
|
|
|
|
|
// return `<section data-transition=${transition}> ${mdIt.renderInline(content)} </section>`;
|
|
|
|
|
//})
|
|
|
|
|
//
|
|
|
|
|
// Paired shortcode for callout
|
|
|
|
|
eleventyConfig.addPairedShortcode("callout", function(content) {
|
|
|
|
|
// The 'content' variable holds the text/HTML placed between
|
|
|
|
|
// {% callout %} and {% endcallout %}
|
|
|
|
|
// We wrap it with our div structure.
|
|
|
|
|
return `<div class="callout">${content}</div>`;
|
|
|
|
|
});
|
|
|
|
|
eleventyConfig.addPairedShortcode("callout", function(content) {
|
|
|
|
|
// The 'content' variable holds the text/HTML placed between
|
|
|
|
|
// {% callout %} and {% endcallout %}
|
|
|
|
|
// We wrap it with our div structure.
|
|
|
|
|
return `<div class="callout">${content}</div>`;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eleventyConfig.addBundle("css");
|
|
|
|
|
eleventyConfig.addBundle("js");
|
|
|
|
|
eleventyConfig.addBundle("html");
|
|
|
|
|
|
|
|
|
|
// Features to make your build faster (when you need them)
|
|
|
|
|
|
|
|
|
|