Playing around with options for base structure and navigation
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
---
|
||||
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 projects = await getCollection('projects');
|
||||
return projects.map(project => ({
|
||||
params: {id: project.id},
|
||||
props: {project: project},
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const {project} = Astro.props;
|
||||
const {Content} = await render(project);
|
||||
---
|
||||
<BaseLayout title={project.id}>
|
||||
<Content/>
|
||||
</BaseLayout>
|
||||
6
src/pages/project/project.astro
Normal file
6
src/pages/project/project.astro
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
</BaseLayout>
|
||||
Reference in New Issue
Block a user