Fix Thai URL decoding in catch-all route

- Added decodeURIComponent to handle URL-encoded Thai characters
- All product and portfolio pages now work correctly
- 64 static pages generated successfully
This commit is contained in:
Kunthawat Greethong
2026-02-26 07:37:12 +07:00
parent 90917b85d0
commit 1ecd405eca

View File

@@ -31,7 +31,9 @@ export async function generateStaticParams() {
type ContentType = 'product' | 'portfolio';
function findContentBySlug(slug: string[]): { type: ContentType; data: typeof productCategories[0] | typeof portfolioProjects[0] } | null {
const fullPath = '/' + slug.join('/') + '/';
// Decode URL-encoded slug parts
const decodedSlug = slug.map(part => decodeURIComponent(part));
const fullPath = '/' + decodedSlug.join('/') + '/';
// Check products first
const product = productCategories.find((p) => p.href === fullPath);