Actualización de Astro, cambio de fechas de los posts, mejora en la indexación, cambio de sitio de los posts, cambio en el workflow a manual
This commit is contained in:
16
src/pages/posts/[id].astro
Normal file
16
src/pages/posts/[id].astro
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
// 1. Generate a new path for every collection entry
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection('posts');
|
||||
return posts.map(post => ({
|
||||
params: { id: post.id },
|
||||
props: { post },
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const { post } = Astro.props;
|
||||
const { Content } = await render(post);
|
||||
---
|
||||
<h1>{post.data.titulo}</h1>
|
||||
<Content />
|
||||
Reference in New Issue
Block a user