fix(routing): resolve 404 on German product pages via rewrites and localized links
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 18s
Build & Deploy / 🧪 QA (push) Successful in 3m7s
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has started running

This commit is contained in:
2026-02-23 12:36:37 +01:00
parent 50fc8a0554
commit 5e48c75a83
3 changed files with 25 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ import { getAllProducts } from '@/lib/mdx';
import { getTranslations } from 'next-intl/server';
import Image from 'next/image';
import { RelatedProductLink } from './RelatedProductLink';
import { mapFileSlugToTranslated } from '@/lib/slugs';
interface RelatedProductsProps {
currentSlug: string;
@@ -16,6 +17,7 @@ export default async function RelatedProducts({
}: RelatedProductsProps) {
const products = await getAllProducts(locale);
const t = await getTranslations('Products');
const productsSlug = await mapFileSlugToTranslated('products', locale);
// Filter products: same category, not current product
const related = products
@@ -61,7 +63,7 @@ export default async function RelatedProducts({
return (
<RelatedProductLink
key={product.slug}
href={`/${locale}/products/${catSlug}/${product.slug}`}
href={`/${locale}/${productsSlug}/${catSlug}/${product.slug}`}
productSlug={product.slug}
productTitle={product.frontmatter.title}
className="group block bg-white rounded-[32px] overflow-hidden shadow-sm hover:shadow-2xl transition-all duration-500 border border-neutral-dark/5"