admin管理员组文章数量:1323701
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 es
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 180 B 111 kB
├ ├ /en/cache-test
├ └ /da/cache-test
But when I check the output, there are no html files generated.
Am I doing this wrong?
本文标签: nextjsHow do I enable static generation when using locale and nextintl with nextjs 15Stack Overflow
版权声明:本文标题:next.js - How do I enable static generation when using [locale] and next-intl with nextjs 15 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742109848a2421194.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论