module.exports = { eleventyComputed: { // TODO: handle titles as slugs instead of filenames permalink: (data) => { // get the file path stem ie "/en/blog/2025/2025-10-18-my-post" let stem = data.page.filePathStem; // strip the leading /en/ prefix if (stem.startsWith("/en/")) { stem = stem.replace(/^\/en/, ""); } // for blog posts under /blog/[year]/[year-month-day]-blogpost // extract the year and the blog post slug (remove date prefix) const blogPostMatch = stem.match(/^\/blog\/(\d{4})\/\d{4}-\d{2}-\d{2}-(.+)$/); if (blogPostMatch) { const [, year, slug] = blogPostMatch; return `/blog/${year}/${slug}/index.html`; // ie /blog/2025/my-post/index.html } // fallback for index or other pages under /blog if (stem.endsWith("/index")) { return `${stem}.html`; // ie /blog/index.html } // default for non-index, non-blog-post pages return `${stem}/index.html`; } } };