feat: implement locale-aware routing with [locale] dynamic segments
Some checks failed
Build and Deploy / build (push) Has been cancelled

WARNING: This change breaks existing SEO URLs for Serbian locale.

Changes:
- Migrated from separate locale folders (src/app/en/, src/app/de/, etc.)
  to [locale] dynamic segments (src/app/[locale]/)
- Serbian is now at /sr/ instead of / (root)
- English at /en/, German at /de/, French at /fr/
- All components updated to generate locale-aware links
- Root / now redirects to /sr (307 temporary redirect)

SEO Impact:
- Previously indexed Serbian URLs (/, /products, /about, /contact)
  will now return 404 or redirect to /sr/* URLs
- This is a breaking change for SEO - Serbian pages should ideally
  remain at root (/) with only non-default locales getting prefix
- Consider implementing 301 redirects from old URLs to maintain
  search engine rankings

Technical Notes:
- next-intl v4 with [locale] structure requires ALL locales to
  have the prefix (cannot have default locale at root)
- Alternative approach would be separate folder structure per locale
This commit is contained in:
Unchained
2026-03-23 20:59:33 +02:00
parent 5bd1a0f167
commit 92b6c830e1
47 changed files with 2175 additions and 2881 deletions

View File

@@ -5,8 +5,13 @@ import Link from "next/link";
import { useTranslations } from "next-intl";
import { ChevronDown } from "lucide-react";
export default function HeroVideo() {
interface HeroVideoProps {
locale?: string;
}
export default function HeroVideo({ locale = "sr" }: HeroVideoProps) {
const t = useTranslations("Home.hero");
const localePath = `/${locale}`;
const scrollToContent = () => {
const element = document.getElementById("main-content");
@@ -84,13 +89,13 @@ export default function HeroVideo() {
className="flex flex-col sm:flex-row items-center justify-center gap-4"
>
<Link
href="/products"
href={`${localePath}/products`}
className="inline-block px-10 py-4 bg-white text-black text-[13px] uppercase tracking-[0.15em] font-semibold hover:bg-white/90 transition-all duration-300 hover:scale-105 shadow-lg hover:shadow-xl"
>
{t("ctaButton")}
</Link>
<Link
href="/about"
href={`${localePath}/about`}
className="inline-block px-10 py-4 border border-white/50 text-white text-[13px] uppercase tracking-[0.15em] font-medium hover:bg-white/10 transition-all duration-300"
>
{t("learnStory")}