diff --git a/es/blog/blog.11tydata.js b/es/blog/blog.11tydata.js index a73f13b..def8c5c 100644 --- a/es/blog/blog.11tydata.js +++ b/es/blog/blog.11tydata.js @@ -1,8 +1,7 @@ module.exports = { eleventyComputed: { - // TODO: handle titles as slugs instead of filenames - permalink: (data) => { - // get the file path stem, e.g., "/es/blog/2025/2025-10-18-my-post" + permalink: function (data) { + // get the file path stem let stem = data.page.filePathStem; // extract the year from the path @@ -12,14 +11,14 @@ module.exports = { // check for slug_override first if (data.slug_override) { - return `/es/blog/${year}/${data.slug_override}/index.html`; // ie /es/blog/2025/post-localizado/index.html + return `/es/blog/${year}/${this.slugify(data.slug_override)}/index.html`; } // handle blog posts with date prefix: /es/blog/[year]/[year-month-day]-slug const blogPostMatch = stem.match(/^\/es\/blog\/(\d{4})\/\d{4}-\d{2}-\d{2}-(.+)$/); if (blogPostMatch) { const [, , slug] = blogPostMatch; - return `/es/blog/${year}/${this.slugify(slug)}/index.html`; // ie /es/blog/2025/my-post/index.html + return `/es/blog/${year}/${this.slugify(slug)}/index.html`; } }