diff --git a/src/app/[locale]/applications/[slug]/page.tsx b/src/app/[locale]/applications/[slug]/page.tsx index 730593d..27a2e76 100644 --- a/src/app/[locale]/applications/[slug]/page.tsx +++ b/src/app/[locale]/applications/[slug]/page.tsx @@ -83,9 +83,20 @@ export async function generateMetadata({ } } -// generateStaticParams omitted — slug pages render on-demand and are cached -// by ISR (revalidate=60). The DYNAMIC_SERVER_USAGE issue that previously -// blocked this is now fixed via setRequestLocale. +// Pre-render all known application slugs at build time. New slugs added +// after deploy render on-demand and get cached by ISR (revalidate=60). +// try/catch ensures the build never fails if the DB is unreachable +// during docker build — pages just render on first request instead. +export async function generateStaticParams() { + try { + const apps = await prisma.application.findMany({ + select: { slug: true }, + }); + return apps.map((app) => ({ slug: app.slug })); + } catch { + return []; + } +} // 🔥 AHORA RECIBIMOS EL LOCALE DESDE LA URL export default async function ApplicationPage({ params }: { params: Promise<{ slug: string, locale: string }> }) { diff --git a/src/app/[locale]/news/[slug]/page.tsx b/src/app/[locale]/news/[slug]/page.tsx index 36f9fe3..9444c7c 100644 --- a/src/app/[locale]/news/[slug]/page.tsx +++ b/src/app/[locale]/news/[slug]/page.tsx @@ -48,9 +48,20 @@ export async function generateMetadata({ } } -// generateStaticParams omitted — slug pages render on-demand and are cached -// by ISR (revalidate=60). The DYNAMIC_SERVER_USAGE issue is fixed via -// setRequestLocale. +// Pre-render all published news slugs at build time. New articles added +// after deploy render on-demand and get cached by ISR (revalidate=60). +// try/catch ensures the build never fails if the DB is unreachable. +export async function generateStaticParams() { + try { + const articles = await prisma.newsArticle.findMany({ + where: { isActive: true }, + select: { slug: true }, + }); + return articles.map((a) => ({ slug: a.slug })); + } catch { + return []; + } +} // ── SÚPER PARSER MARKDOWN (Con Tablas, Imágenes y Dark/Light Mode) ── // ... (El código del Súper Parser se queda IGUAL, no te preocupes) ...