sofi-web/.eleventy.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-12-06 17:17:16 +00:00
const { DateTime } = require("luxon")
2023-11-25 18:48:11 +00:00
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
2023-12-06 17:17:16 +00:00
const timeToRead = require("eleventy-plugin-time-to-read")
2023-11-25 18:48:11 +00:00
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({ "static": "/" })
2023-12-06 17:17:16 +00:00
eleventyConfig.addPlugin(timeToRead, {
language: "en",
style: "long",
hours: "auto",
minutes: true,
})
2023-11-25 18:48:11 +00:00
eleventyConfig.setLibrary("md", markdownIt({
html: true
}).use(markdownItAnchor, {
level: 2
}))
2023-12-06 17:17:16 +00:00
eleventyConfig.addFilter("relevantTags", tags => tags.filter(v => !["archived", "post"].includes(v)))
eleventyConfig.addFilter("readableDate", dateObj => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).setLocale("es-ES").toFormat("dd LLL yyyy");
})
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', dateObj => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
})
2023-11-25 18:48:11 +00:00
return {
passthroughFileCopy: true,
dir: {
input: "src"
}
}
}