const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const bundlerPlugin = require("@11ty/eleventy-plugin-bundle");
const fs = require('fs');
// update this :)
const year = 2024;
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: "de",
});
eleventyConfig.addPlugin(bundlerPlugin);
eleventyConfig.addGlobalData("year", year);
eleventyConfig.addFilter("pageLang", function(value) {
return value.filter(item => item.page.lang === this.page.lang)
});
// 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);
});
}
}
);
return {
dir: {
input: "content",
includes: "../_includes",
layouts: "../_layouts",
data: "../_data",
},
pathPrefix: `/${year}/`,
}
};