Add experience pages
This commit is contained in:
18
src/pages/experience/[id].astro
Normal file
18
src/pages/experience/[id].astro
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
import {getCollection, render} from 'astro:content';
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
// 1. Generate a new path for every collection entry
|
||||
export async function getStaticPaths() {
|
||||
const experiences = await getCollection('experiences');
|
||||
return experiences.map(experience => ({
|
||||
params: {id: experience.id},
|
||||
props: {project: experience},
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const {experience} = Astro.props;
|
||||
const {Content} = await render(experience);
|
||||
---
|
||||
<BaseLayout title={experience.id}>
|
||||
<Content/>
|
||||
</BaseLayout>
|
||||
Reference in New Issue
Block a user