Skip to content

Commit 7989cfc

Browse files
archer-clawarcher
andauthored
fix: skip FAQ page generation when NEXT_PUBLIC_FAQ is disabled (#148)
- Add showFAQ check in generateStaticParams for both FAQ list and detail pages - Prevents build errors when FAQ feature is disabled via environment variable - Returns empty array instead of generating paths that will 404 Co-authored-by: archer <archer@archerdeMac-mini.local>
1 parent 6efe15d commit 7989cfc

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/app/[lang]/faq/[id]/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ export default async function FAQDetailPage({
9696

9797
// Generate static paths for all FAQs in all languages
9898
export async function generateStaticParams() {
99+
// Don't generate any paths if FAQ is disabled
100+
if (!showFAQ) {
101+
return [];
102+
}
103+
99104
const faqKeys = Object.keys(faq);
100105
const languages = Object.keys(localeNames);
101106

src/app/[lang]/faq/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export default async function FAQPage({
5757

5858
// Generate static paths for all supported languages
5959
export async function generateStaticParams() {
60+
// Don't generate any paths if FAQ is disabled
61+
if (!showFAQ) {
62+
return [];
63+
}
6064
return Object.keys(localeNames).map((lang) => ({ lang }));
6165
}
6266

0 commit comments

Comments
 (0)