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;
const eseColor = "#F221B7";
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: "de",
});
eleventyConfig.addPlugin(bundlerPlugin);
eleventyConfig.addGlobalData("year", year);
eleventyConfig.addGlobalData("eseColor", eseColor);
eleventyConfig.addFilter("pageLang", function(value) {
return value.filter(item => item.page.lang === this.page.lang)
});
// copy aileron font
eleventyConfig.addPassthroughCopy({'./submodules/aileron/fonts/*.(ttf|woff|woff2)': 'fonts'})
eleventyConfig.addPassthroughCopy({'./submodules/aileron/aileron.lite.min.css': 'aileron.lite.min.css'})
// copy static files
eleventyConfig.addPassthroughCopy('./static')
// 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",
data: "../_data",
},
pathPrefix: `/${year}/`,
}
};