feat: add localized home routes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useI18n, type Lang } from "../i18n";
|
||||
import { isHomePathname } from "../languageRoutes";
|
||||
|
||||
type PageMeta = {
|
||||
title: string;
|
||||
@@ -83,7 +84,7 @@ function routeMeta(
|
||||
const q = params.get("q")?.trim();
|
||||
const sort = params.get("sort");
|
||||
|
||||
if (pathname === "/") {
|
||||
if (isHomePathname(pathname)) {
|
||||
return {
|
||||
title: t("heroTitle"),
|
||||
description: metaDescription(lang, "home"),
|
||||
@@ -146,7 +147,9 @@ export function DocumentMeta() {
|
||||
|
||||
useEffect(() => {
|
||||
const brand = t("brand");
|
||||
const title = pathname === "/" ? meta.title : `${meta.title} | ${brand}`;
|
||||
const title = isHomePathname(pathname)
|
||||
? meta.title
|
||||
: `${meta.title} | ${brand}`;
|
||||
const canonical = `${window.location.origin}${pathname}${search}`;
|
||||
|
||||
document.documentElement.lang = lang;
|
||||
|
||||
Reference in New Issue
Block a user