first
This commit is contained in:
commit
8538ab969a
434 changed files with 44051 additions and 0 deletions
68
apps/web/app/(marketing)/[locale]/legal/[...path]/page.tsx
Normal file
68
apps/web/app/(marketing)/[locale]/legal/[...path]/page.tsx
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import { localeRedirect } from "@i18n/routing";
|
||||
import { PostContent } from "@marketing/blog/components/PostContent";
|
||||
import {
|
||||
getActivePathFromUrlParam,
|
||||
getLocalizedDocumentWithFallback,
|
||||
} from "@shared/lib/content";
|
||||
import { allLegalPages } from "content-collections";
|
||||
import { getLocale } from "next-intl/server";
|
||||
|
||||
type Params = {
|
||||
path: string;
|
||||
locale: string;
|
||||
};
|
||||
|
||||
export async function generateMetadata(props: {
|
||||
params: Promise<Params>;
|
||||
}) {
|
||||
const params = await props.params;
|
||||
|
||||
const { path } = params;
|
||||
|
||||
const locale = await getLocale();
|
||||
const activePath = getActivePathFromUrlParam(path);
|
||||
const page = getLocalizedDocumentWithFallback(
|
||||
allLegalPages,
|
||||
activePath,
|
||||
locale,
|
||||
);
|
||||
|
||||
return {
|
||||
title: page?.title,
|
||||
openGraph: {
|
||||
title: page?.title,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default async function BlogPostPage(props: {
|
||||
params: Promise<Params>;
|
||||
}) {
|
||||
const params = await props.params;
|
||||
|
||||
const { path } = params;
|
||||
|
||||
const locale = await getLocale();
|
||||
const activePath = getActivePathFromUrlParam(path);
|
||||
const page = getLocalizedDocumentWithFallback(
|
||||
allLegalPages,
|
||||
activePath,
|
||||
locale,
|
||||
);
|
||||
|
||||
if (!page) {
|
||||
localeRedirect({ href: "/", locale });
|
||||
}
|
||||
|
||||
const { title, body } = page;
|
||||
|
||||
return (
|
||||
<div className="container max-w-6xl pt-32 pb-24">
|
||||
<div className="mx-auto mb-12 max-w-2xl">
|
||||
<h1 className="text-center font-bold text-4xl">{title}</h1>
|
||||
</div>
|
||||
|
||||
<PostContent content={body} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue