This commit is contained in:
parent
8cff085e59
commit
443347cad6
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
||||||
<link rel="stylesheet" href="{% getBundleFileUrl "css", "defer" %}">
|
<link rel="stylesheet" href="{% getBundleFileUrl "css", "defer" %}">
|
||||||
|
<script src="{% getBundleFileUrl "js" %}"></script>
|
||||||
|
<script src="{% getBundleFileUrl "js", "module %}"></script>
|
||||||
|
{% getBundle "html", "head" %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a href="#skip" class="visually-hidden">Skip to main content</a>
|
<a href="#skip" class="visually-hidden">Skip to main content</a>
|
||||||
|
|
|
@ -16,7 +16,7 @@ import pluginDrafts from "./eleventy.config.drafts.js";
|
||||||
|
|
||||||
|
|
||||||
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
|
/** @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
|
// Copy the contents of the `public` folder to the output folder
|
||||||
// For example, `./public/css/` ends up in `_site/css/`
|
// For example, `./public/css/` ends up in `_site/css/`
|
||||||
eleventyConfig.addPassthroughCopy({
|
eleventyConfig.addPassthroughCopy({
|
||||||
|
@ -27,9 +27,6 @@ export default async function (eleventyConfig) {
|
||||||
"./node_modules/reveal.js/plugin/": "/revealjs-plugins/",
|
"./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.
|
// Watch content images for the image pipeline.
|
||||||
eleventyConfig.addWatchTarget("content/**/*.{svg,webp,png,jpeg}");
|
eleventyConfig.addWatchTarget("content/**/*.{svg,webp,png,jpeg}");
|
||||||
|
|
||||||
|
@ -67,8 +64,8 @@ export default async function (eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(pluginBundle);
|
eleventyConfig.addPlugin(pluginBundle);
|
||||||
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
|
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
|
||||||
extensions: "html",
|
extensions: "html",
|
||||||
formats: [ "webp", "jpeg", null ],
|
formats: ["webp", "jpeg", null],
|
||||||
widths: [ 400, 800, 1280, null ],
|
widths: [400, 800, 1280, null],
|
||||||
defaultAttributes: {
|
defaultAttributes: {
|
||||||
loading: "lazy",
|
loading: "lazy",
|
||||||
decoding: "async",
|
decoding: "async",
|
||||||
|
@ -86,15 +83,15 @@ export default async function (eleventyConfig) {
|
||||||
|
|
||||||
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
|
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
|
||||||
// dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
|
// 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.
|
// Get the first `n` elements of a collection.
|
||||||
eleventyConfig.addFilter("head", (array, n) => {
|
eleventyConfig.addFilter("head", (array, n) => {
|
||||||
if(!Array.isArray(array) || array.length === 0) {
|
if (!Array.isArray(array) || array.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if( n < 0 ) {
|
if (n < 0) {
|
||||||
return array.slice(n);
|
return array.slice(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +106,7 @@ export default async function (eleventyConfig) {
|
||||||
// Return all the tags used in a collection
|
// Return all the tags used in a collection
|
||||||
eleventyConfig.addFilter("getAllTags", collection => {
|
eleventyConfig.addFilter("getAllTags", collection => {
|
||||||
let tagSet = new Set();
|
let tagSet = new Set();
|
||||||
for(let item of collection) {
|
for (let item of collection) {
|
||||||
(item.data.tags || []).forEach(tag => tagSet.add(tag));
|
(item.data.tags || []).forEach(tag => tagSet.add(tag));
|
||||||
}
|
}
|
||||||
return Array.from(tagSet);
|
return Array.from(tagSet);
|
||||||
|
@ -131,7 +128,7 @@ export default async function (eleventyConfig) {
|
||||||
symbol: "@",
|
symbol: "@",
|
||||||
ariaHidden: false,
|
ariaHidden: false,
|
||||||
}),
|
}),
|
||||||
level: [1,2,3,4],
|
level: [1, 2, 3, 4],
|
||||||
slugify: eleventyConfig.getFilter("slugify")
|
slugify: eleventyConfig.getFilter("slugify")
|
||||||
});
|
});
|
||||||
mdLib.use(markdownItAbbr);
|
mdLib.use(markdownItAbbr);
|
||||||
|
@ -146,7 +143,6 @@ export default async function (eleventyConfig) {
|
||||||
// return `<section data-transition=${transition}> ${mdIt.renderInline(content)} </section>`;
|
// return `<section data-transition=${transition}> ${mdIt.renderInline(content)} </section>`;
|
||||||
//})
|
//})
|
||||||
//
|
//
|
||||||
// Paired shortcode for callout
|
|
||||||
eleventyConfig.addPairedShortcode("callout", function(content) {
|
eleventyConfig.addPairedShortcode("callout", function(content) {
|
||||||
// The 'content' variable holds the text/HTML placed between
|
// The 'content' variable holds the text/HTML placed between
|
||||||
// {% callout %} and {% endcallout %}
|
// {% callout %} and {% endcallout %}
|
||||||
|
@ -154,6 +150,10 @@ export default async function (eleventyConfig) {
|
||||||
return `<div class="callout">${content}</div>`;
|
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)
|
// Features to make your build faster (when you need them)
|
||||||
|
|
||||||
// If your passthrough copy gets heavy and cumbersome, add this line
|
// If your passthrough copy gets heavy and cumbersome, add this line
|
||||||
|
|
Loading…
Reference in a new issue