fix: properly build static pages this time
Some checks failed
/ deploy (push) Failing after 54s

This commit is contained in:
Dariusz Niemczyk 2025-02-20 17:50:34 +01:00
parent 53883f4148
commit eb55bfe905
No known key found for this signature in database
2 changed files with 26 additions and 16 deletions

View file

@ -1,5 +1,6 @@
import { notFound } from "next/navigation" import { notFound } from "next/navigation";
export default function NotFoundDummy() { export default function NotFoundDummy() {
console.log("Global catch-all 404 page");
notFound() notFound()
} }

View file

@ -1,34 +1,43 @@
import { getLocale, Lang } from "@/i18n/locales" import { getLocale, Lang } from "@/i18n/locales";
import { notFound } from "next/navigation" import { notFound } from "next/navigation";
export default async function Page({ export default async function Page({
params, params,
}: { }: {
params: Promise<{ slug: string, locale: Lang }> params: Promise<{ slug: string; locale: Lang }>;
}) { }) {
const { slug, locale } = await params const { slug, locale } = await params;
const currentLocale = getLocale(locale) const currentLocale = getLocale(locale);
const isReallyProperSlug = /^[a-zA-Z0-9_-]+$/.test(slug) const isReallyProperSlug = /^[a-zA-Z0-9_-]+$/.test(slug);
if (!isReallyProperSlug) { if (!isReallyProperSlug) {
notFound() notFound();
} }
try { try {
const path = `@/pages/${currentLocale}/${slug}.mdx` console.log("Resolving path: ", `@/pages/${currentLocale}/${slug}.mdx`);
const pagemodule = await import(path) const pagemodule = await import(`@/pages/${currentLocale}/${slug}.mdx`);
const Post = pagemodule.default const Post = pagemodule.default;
return <Post /> return <Post />;
} catch (error) { } catch (error) {
console.log(error) console.log(error);
notFound() notFound();
} }
} }
export function generateStaticParams() { export function generateStaticParams() {
return [{ slug: 'privacy' }] return [
{
locale: "pl",
slug: "privacy",
},
{
locale: "en",
slug: "privacy",
},
];
} }
export const dynamicParams = false export const dynamicParams = false;