generated from avior/template-web-astro
feat: Add first version of website
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
26
src/pages/projets/[project].astro
Normal file
26
src/pages/projets/[project].astro
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
import Article from 'layouts/Article.astro'
|
||||
|
||||
export const prerender = true
|
||||
// 1. Generate a new path for every collection entry
|
||||
export async function getStaticPaths() {
|
||||
const blogEntries = await getCollection('projects');
|
||||
return blogEntries.map(entry => ({
|
||||
params: { project: entry.slug }, props: { entry },
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const { entry } = Astro.props;
|
||||
const { Content } = await entry.render();
|
||||
---
|
||||
<Article title={entry.data.title} link={entry.data.link} breadcrumb={[{text: 'Accueil', href: '/'}, {text: 'Projets', href: '/projets'}, {text: entry.data.title}]}>
|
||||
<h1>{entry.data.title}</h1>
|
||||
<p class="flex justify-end font-lights my-0">
|
||||
<span>Sortie initial le {entry.data.created.toLocaleDateString('fr')}</span>
|
||||
<!-- <p>Software updated: {entry.data.updated.toLocaleDateString()}</p> -->
|
||||
</p>
|
||||
|
||||
<Content />
|
||||
|
||||
</Article>
|
Reference in New Issue
Block a user