This commit is contained in:
@@ -5,7 +5,8 @@ import { getTranslations } from 'next-intl/server';
|
||||
import { Metadata } from 'next';
|
||||
import { getPageBySlug } from '@/lib/pages';
|
||||
import { mdxComponents } from '@/components/blog/MDXComponents';
|
||||
|
||||
import { getAllPages } from '@/lib/pages';
|
||||
import { mapFileSlugToTranslated } from '@/lib/slugs';
|
||||
interface PageProps {
|
||||
params: {
|
||||
locale: string;
|
||||
@@ -13,6 +14,21 @@ interface PageProps {
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const locales = ['en', 'de'];
|
||||
const params = [];
|
||||
|
||||
for (const locale of locales) {
|
||||
const pages = await getAllPages(locale);
|
||||
for (const page of pages) {
|
||||
const translatedSlug = await mapFileSlugToTranslated(page.slug, locale);
|
||||
params.push({ locale, slug: translatedSlug });
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params: { locale, slug } }: PageProps): Promise<Metadata> {
|
||||
const pageData = await getPageBySlug(slug, locale);
|
||||
|
||||
@@ -42,6 +58,20 @@ export async function generateMetadata({ params: { locale, slug } }: PageProps):
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const locales = ['en', 'de'];
|
||||
const params = [];
|
||||
|
||||
for (const locale of locales) {
|
||||
const pages = await getAllPages(locale);
|
||||
for (const page of pages) {
|
||||
const translatedSlug = await mapFileSlugToTranslated(page.slug, locale);
|
||||
params.push({ locale, slug: translatedSlug });
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
export default async function StandardPage({ params: { locale, slug } }: PageProps) {
|
||||
const pageData = await getPageBySlug(slug, locale);
|
||||
const t = await getTranslations('StandardPage');
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"Slugs": {
|
||||
"pages": {
|
||||
"impressum": "legal-notice",
|
||||
"datenschutz": "privacy-policy",
|
||||
"agbs": "terms",
|
||||
"impressum": "impressum",
|
||||
"datenschutz": "datenschutz",
|
||||
"agbs": "agbs",
|
||||
"kontakt": "contact",
|
||||
"team": "team",
|
||||
"blog": "blog",
|
||||
|
||||
Reference in New Issue
Block a user