29 lines
730 B
Plaintext
29 lines
730 B
Plaintext
---
|
|
import { resolveAllPaths, type ResolvedEntry } from '../lib/paths';
|
|
import type { CollectionEntry } from 'astro:content';
|
|
import ArticleLayout from '../layouts/ArticleLayout.astro';
|
|
import PageLayout from '../layouts/PageLayout.astro';
|
|
|
|
export async function getStaticPaths() {
|
|
const entries = await resolveAllPaths();
|
|
return entries.map((entry) => ({
|
|
params: { path: entry.path },
|
|
props: entry,
|
|
}));
|
|
}
|
|
const { type, entry } = Astro.props as ResolvedEntry;
|
|
|
|
const props = Astro.props as ResolvedEntry;
|
|
---
|
|
|
|
{
|
|
type === 'article' && (
|
|
<ArticleLayout entry={props.entry as CollectionEntry<'articles'>} />
|
|
)
|
|
}
|
|
{
|
|
type === 'page' && (
|
|
<PageLayout entry={props.entry as CollectionEntry<'pages'>} />
|
|
)
|
|
}
|