From 49c23d595d1b0e54c086b46a4398ed17fe2bc98d Mon Sep 17 00:00:00 2001 From: xMike Date: Fri, 27 Feb 2026 11:26:41 +0100 Subject: [PATCH] Fix slugify to handle accented characters and apostrophes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The slugify function was stripping accented characters entirely (é→nothing) and inserting hyphens around apostrophes (d'accueil→d-accueil). This broke section ID matching for French, Spanish, German, and other languages. - Normalize Unicode NFD and strip diacritics (é→e, ü→u) - Remove apostrophes without inserting hyphens Co-Authored-By: Claude Opus 4.6 --- src/lib/product-loader.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/product-loader.ts b/src/lib/product-loader.ts index fac5704..dabba2a 100644 --- a/src/lib/product-loader.ts +++ b/src/lib/product-loader.ts @@ -27,8 +27,11 @@ const exportZipFiles = import.meta.glob('/product-plan.zip', { */ function slugify(str: string): string { return str + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') // Remove diacritics (é→e, ü→u, etc.) .toLowerCase() .replace(/\s+&\s+/g, '-and-') // Convert " & " to "-and-" first + .replace(/['']/g, '') // Remove apostrophes without inserting hyphens .replace(/[^a-z0-9]+/g, '-') .replace(/(^-|-$)/g, '') }