detail view, linked list, layout tweaks
This commit is contained in:
20
client/src/pages/elements/[...id].astro
Normal file
20
client/src/pages/elements/[...id].astro
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
import MardownContent from '../../components/MardownContent.astro';
|
||||
import Layout from '../../layouts/Layout.astro';
|
||||
|
||||
// 1. Genera una nueva ruta para cada entrada de colección
|
||||
export async function getStaticPaths() {
|
||||
const poleElements = await getCollection('poleElements');
|
||||
return poleElements.map(entry => ({
|
||||
params: { id: entry.id }, props: { entry },
|
||||
}));
|
||||
}
|
||||
// 2. Para tu plantilla, puedes obtener la entrada directamente de la prop
|
||||
const { entry } = Astro.props;
|
||||
---
|
||||
|
||||
<Layout title={entry.data.title} description={entry.data.description}>
|
||||
<h1>{entry.data.title}</h1>
|
||||
<MardownContent content={entry.data.description} />
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user