This repository has been archived on 2024-02-11. You can view files and clone it, but cannot push or open issues or pull requests.
sitio/.eleventy.js

53 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2023-11-12 09:37:38 +00:00
const { basename } = require("path");
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
const automaticNoopener = require("eleventy-plugin-automatic-noopener");
const markdownItWikilinks = require("markdown-it-wikilinks")({
uriSuffix: "",
2023-11-20 16:22:48 +00:00
generatePagePathFromLabel: (label) => `${label}/`,
postProcessPagePath: (path) => path,
2023-11-12 09:37:38 +00:00
postProcessLabel: (path) => basename(path).match(/^(?:(?:\d{4})-(?:\d{2})-(?:\d{2})-)?(.+)$/)[1],
relativeBaseURL: "../",
});
const { formatDate } = require("./helpers/date");
/**
* @param {import("@11ty/eleventy").UserConfig} eleventyConfig
*/
module.exports = function config(eleventyConfig) {
eleventyConfig.addPassthroughCopy("drip.css");
eleventyConfig.addPassthroughCopy("cowboy.svg");
eleventyConfig.addPassthroughCopy("status/*");
2023-11-12 10:02:18 +00:00
eleventyConfig.addPassthroughCopy("redirects.caddy");
2023-11-12 09:37:38 +00:00
eleventyConfig.addPassthroughCopy("x/**/*.png");
eleventyConfig.addPassthroughCopy("x/**/*.jpg");
eleventyConfig.addPassthroughCopy("x/**/*.mp4");
eleventyConfig.addPassthroughCopy("bookmarks/**/*.png");
eleventyConfig.addPassthroughCopy("bookmarks/**/*.jpg");
eleventyConfig.addPassthroughCopy("bookmarks/**/*.mp4");
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(automaticNoopener, {
noreferrer: false,
});
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownItWikilinks));
eleventyConfig.addCollection("x", (collectionApi) => collectionApi.getFilteredByGlob("x/**/*"));
eleventyConfig.addShortcode(
"dateToISO",
2023-11-20 16:22:48 +00:00
/** @param {Date} date */ (date) => date.toISOString().slice(0, 10),
2023-11-12 09:37:38 +00:00
);
eleventyConfig.addShortcode("formatDate", formatDate);
eleventyConfig.addShortcode("relativeLink", (link, baseUrl) => new URL(link, baseUrl).toString());
// eleventyConfig.addShortcode("formatDateish", formatDateish);
// eleventyConfig.addShortcode("dateishToElement", dateishToElement);
return {
dir: {
output: "build",
},
};
};