Next.js Discord

Discord Forum

Generating static html files not working with dynamic paths?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I've been trying to get SSG to work properly with NextJs 15 and next-intl for localization as my site has 2 locales: en and da

I tried the following:

import { routing } from '@/i18n/routing';
import { setRequestLocale } from "next-intl/server";
import { use } from "react";

// This ensures all possible paths are generated at build time
export function generateStaticParams({params}) {
return routing.locales.map((locale) => ({ locale }));
}

export default function CacheTest({params}) {
const {locale} = use(params);
// Enable static rendering
setRequestLocale(locale);

return (
<section className="cache-test">
<h1>This page should be static!</h1>
<p>{params.locale}</p>

</section>
);
}```

When I run the build, it appears as if the pages are statically generated:

├ ● /[locale]/cache-test
├ ├ /en/cache-test
├ └ /da/cache-test

But when I check the output, there are no html files generated.

Am I doing this wrong?

0 Replies