Files
oki-foundation/eleventy.config.js
T

49 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-07-06 08:33:43 +04:00
const cdn = require("./src/_data/cdn.json");
2025-11-05 17:32:17 +04:00
module.exports = function(eleventyConfig) {
// Locale-aware content: `t` resolves to the content bundle for the page's locale (fr by default)
eleventyConfig.addGlobalData("eleventyComputed", {
locale: (data) => data.locale || "fr",
t: (data) => data.i18n[data.locale || "fr"]
});
2026-07-06 08:33:43 +04:00
// Serve local images through the BunnyCDN pull zone; leaves external URLs untouched
eleventyConfig.addFilter("cdn", (path) => {
if (typeof path !== "string" || !path.startsWith("/")) return path;
return cdn.url + path;
});
2025-11-05 17:32:17 +04:00
// Copy assets folders to output
eleventyConfig.addPassthroughCopy("src/assets");
2025-11-05 17:41:27 +04:00
// Copy SEO files
eleventyConfig.addPassthroughCopy("src/robots.txt");
eleventyConfig.addPassthroughCopy("src/sitemap.xml");
// Copy Apache security headers config to the site root
eleventyConfig.addPassthroughCopy({ "src/.htaccess": ".htaccess" });
2025-11-05 17:32:17 +04:00
// Watch CSS files for changes
eleventyConfig.addWatchTarget("src/assets/css/");
// Watch JS files for changes
eleventyConfig.addWatchTarget("src/assets/js/");
// Configure browser sync to reload on CSS changes
eleventyConfig.setBrowserSyncConfig({
files: ['_site/assets/css/**/*.css', '_site/assets/js/**/*.js']
});
return {
dir: {
input: "src",
output: "_site",
includes: "_includes",
data: "_data"
},
templateFormats: ["html", "md", "njk", "liquid"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk"
};
};