This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { Container } from "@/components/layout/container";
|
||||
@@ -7,7 +7,7 @@ import { PageHero } from "@/components/layout/page-hero";
|
||||
import { PortfolioProjectDetail } from "@/components/site/portfolio-project-detail";
|
||||
import { getSiteSettings } from "@/lib/app-config";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
|
||||
import { resolveLocale } from "@/lib/locale";
|
||||
import {
|
||||
getLocalizedValue,
|
||||
getPublishedPortfolioProjectBySlug,
|
||||
@@ -23,8 +23,9 @@ type PortfolioItemPageProps = {
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: PortfolioItemPageProps): Promise<Metadata> {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const { slug } = await params;
|
||||
const siteSettings = await getSiteSettings();
|
||||
const localeKey = resolveLocale(await getLocale().catch(() => siteSettings.defaultLocale), siteSettings.defaultLocale);
|
||||
const item = await getPublishedPortfolioProjectBySlug(slug);
|
||||
|
||||
if (!item) {
|
||||
@@ -47,18 +48,16 @@ export async function generateMetadata({ params }: PortfolioItemPageProps): Prom
|
||||
export default async function PortfolioItemPage({
|
||||
params,
|
||||
}: PortfolioItemPageProps) {
|
||||
const { locale, slug } = await params;
|
||||
const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
|
||||
const { slug } = await params;
|
||||
const siteSettings = await getSiteSettings();
|
||||
const localeKey = resolveLocale(await getLocale().catch(() => siteSettings.defaultLocale), siteSettings.defaultLocale);
|
||||
const item = await getPublishedPortfolioProjectBySlug(slug);
|
||||
|
||||
if (!item) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const [t, siteSettings] = await Promise.all([
|
||||
getTranslations({ locale: localeKey, namespace: "portfolioDetail" }),
|
||||
getSiteSettings(),
|
||||
]);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" });
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user