fix: `getStaticPaths` doesn't run unless in `prerender` mode

master
Avraham Sakal 5 months ago
parent 8532af4c04
commit f4714839dd

@ -5,6 +5,8 @@ import Heading from 'fulldev-ui/components/Heading.astro';
import Link from 'fulldev-ui/components/Link.astro'; import Link from 'fulldev-ui/components/Link.astro';
import RegularText from './RegularText.astro'; import RegularText from './RegularText.astro';
export const prerender = true;
// 1. Generate a new path for every collection entry // 1. Generate a new path for every collection entry
export async function getStaticPaths() { export async function getStaticPaths() {
const journalEntries = await getCollection('journal-entries'); const journalEntries = await getCollection('journal-entries');
@ -16,6 +18,7 @@ export async function getStaticPaths() {
// 2. For your template, you can get the entry directly from the prop // 2. For your template, you can get the entry directly from the prop
const { journalEntry } = Astro.props; const { journalEntry } = Astro.props;
const { Content } = await journalEntry.render(); const { Content } = await journalEntry.render();
--- ---
<Layout title={journalEntry.data.title}> <Layout title={journalEntry.data.title}>
<main> <main>

Loading…
Cancel
Save