generated from avior/template-web-astro
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
---
|
|
import { getCollection } from 'astro:content';
|
|
import Picture from 'components/Picture.astro'
|
|
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 as Awaited<ReturnType<typeof getStaticPaths>>[0]['props'];
|
|
const { Content } = await entry.render();
|
|
---
|
|
<Article
|
|
title={entry.data.title}
|
|
image={entry.data.image ? [entry.data.image] : undefined}
|
|
description={entry.data.description}
|
|
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">
|
|
{entry.data.created && (
|
|
<span>Sortie initial le {entry.data.created.toLocaleDateString('fr')}</span>
|
|
)}
|
|
<!-- <p>Software updated: {entry.data.updated.toLocaleDateString()}</p> -->
|
|
</p>
|
|
|
|
<Content components={{img: Picture }}/>
|
|
|
|
</Article>
|