feat: servir les images via le CDN BunnyCDN

This commit is contained in:
2026-07-06 08:33:43 +04:00
parent 37121763a9
commit 58dd9297e0
7 changed files with 23 additions and 12 deletions
+8
View File
@@ -1,3 +1,5 @@
const cdn = require("./src/_data/cdn.json");
module.exports = function(eleventyConfig) {
// Locale-aware content: `t` resolves to the content bundle for the page's locale (fr by default)
eleventyConfig.addGlobalData("eleventyComputed", {
@@ -5,6 +7,12 @@ module.exports = function(eleventyConfig) {
t: (data) => data.i18n[data.locale || "fr"]
});
// 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;
});
// Copy assets folders to output
eleventyConfig.addPassthroughCopy("src/assets");