fix: require PB_URL in production, fall back to localhost in dev only #5
@@ -8,11 +8,15 @@ import { SectionsAccordion } from '$widgets/SectionsAccordion';
|
|||||||
* Optional catchall: `/` → first section, `/:slug` → that section.
|
* Optional catchall: `/` → first section, `/:slug` → that section.
|
||||||
*/
|
*/
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
|
try {
|
||||||
const { items: sections } = await getCollection<SectionRecord>('sections', {
|
const { items: sections } = await getCollection<SectionRecord>('sections', {
|
||||||
sort: 'order',
|
sort: 'order',
|
||||||
tags: ['sections'],
|
|
||||||
});
|
});
|
||||||
return [{}, ...sections.map((s) => ({ slug: [s.slug] }))];
|
return [{}, ...sections.map((s) => ({ slug: [s.slug] }))];
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('[generateStaticParams] PocketBase unreachable at build — deferring to runtime ISR', err);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
Reference in New Issue
Block a user