module.exports = {
    lang: "en",
    permalink: data => {
        // `data.page.filePathStem` is the input path without extension, starting with a leading slash
        // e.g. "/en/index" or "/en/blog/test-post"
        const stem = data.page.filePathStem;
        if (stem === "/en/index") {
            // For /en/index.md → /index.html
            return "/index.html";
        }
        if (stem.startsWith("/en/")) {
            // For /en/anything-else.md (including subfolders), remove only the first /en
            // e.g. /en/blog/test-post → /en/blog/test-post/index.html
            return `${stem.replace(/^\/en/, "")}/index.html`;
        }
        // fallback: default 11ty behavior
        return data.page.outputPath;
    }
};