ese-website/eleventy.config.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-09-14 10:59:22 +02:00
const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy");
2024-09-13 17:18:41 +02:00
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
2024-09-15 13:18:05 +02:00
const bundlerPlugin = require("@11ty/eleventy-plugin-bundle");
2024-09-14 12:44:27 +02:00
const fs = require('fs');
2024-09-12 13:41:52 +02:00
// update this :)
const year = 2024;
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
2024-09-13 17:18:41 +02:00
eleventyConfig.addPlugin(eleventyNavigationPlugin);
2024-09-14 10:59:22 +02:00
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: "de",
});
2024-09-15 13:18:05 +02:00
eleventyConfig.addPlugin(bundlerPlugin);
2024-09-12 13:41:52 +02:00
eleventyConfig.addGlobalData("year", year);
2024-09-14 10:59:22 +02:00
eleventyConfig.addFilter("pageLang", function(value) {
return value.filter(item => item.page.lang === this.page.lang)
});
2024-09-14 12:44:27 +02:00
// copy german start page to root url
eleventyConfig.on(
"eleventy.after",
async ({ dir, runMode, outputMode }) => {
if (outputMode === "fs") {
fs.copyFile(`${dir.output}/de/index.html`, `${dir.output}/index.html`, (err) => {
if (err) console.log(err);
});
}
}
);
2024-09-12 13:41:52 +02:00
return {
dir: {
input: "content",
2024-09-13 17:04:16 +02:00
includes: "../_includes",
layouts: "../_layouts",
data: "../_data",
2024-09-12 13:41:52 +02:00
},
pathPrefix: `/${year}/`,
}
};