detail view, linked list, layout tweaks

This commit is contained in:
2025-06-22 01:12:03 +02:00
parent 6c48ed2925
commit 3eddcc5f6a
7 changed files with 115 additions and 136 deletions

View 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>