première publication

This commit is contained in:
2026-01-11 15:54:07 +04:00
parent bba4534872
commit 34e5c342f8
9 changed files with 246 additions and 18 deletions

View File

@@ -1,11 +1,10 @@
---
import Welcome from '../components/Welcome.astro';
import Layout from '../layouts/Layout.astro';
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
---
<Layout>
<Welcome />
<Layout title="Bienvenue sur Sweet">
<h1>Bienvenue sur le projet Sweet !</h1>
<p>
Ce site est une expérience communautaire. Explorez le journal d'aventure pour suivre la quête, ou consultez les logs de construction pour voir les coulisses techniques.
</p>
</Layout>

View File

@@ -0,0 +1,24 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/Layout.astro';
// 1. Génère une page pour chaque entrée de la collection 'journal'
export async function getStaticPaths() {
const journalEntries = await getCollection('journal');
return journalEntries.map(entry => ({
params: { slug: entry.slug },
props: { entry },
}));
}
// 2. Récupère les props pour la page actuelle
const { entry } = Astro.props;
const { Content } = await entry.render();
---
<Layout title={entry.data.title}>
<h1>{entry.data.title}</h1>
<p>Par {entry.data.author}, le {entry.data.publishDate.toLocaleDateString('fr-FR')}</p>
<hr>
<Content />
</Layout>

View File

@@ -0,0 +1,18 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/Layout.astro';
const allJournalEntries = await getCollection('journal');
---
<Layout title="Journal d'Aventure">
<h1>Journal d'Aventure</h1>
<ul>
{allJournalEntries.map(entry => (
<li>
<a href={`/journal/${entry.slug}`}>{entry.data.title}</a>
<p>Publié le: {entry.data.publishDate.toLocaleDateString('fr-FR')}</p>
</li>
))}
</ul>
</Layout>

View File

@@ -0,0 +1,24 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/Layout.astro';
// 1. Génère une page pour chaque entrée de la collection 'logs'
export async function getStaticPaths() {
const journalEntries = await getCollection('logs');
return journalEntries.map(entry => ({
params: { slug: entry.slug },
props: { entry },
}));
}
// 2. Récupère les props pour la page actuelle
const { entry } = Astro.props;
const { Content } = await entry.render();
---
<Layout title={entry.data.title}>
<h1>{entry.data.title}</h1>
<p>Publié le {entry.data.publishDate.toLocaleDateString('fr-FR')}</p>
<hr>
<Content />
</Layout>

View File

@@ -0,0 +1,18 @@
---
import { getCollection } from 'astro:content';
import Layout from '../../layouts/Layout.astro';
const allLogEntries = await getCollection('logs');
---
<Layout title="Logs de Construction">
<h1>Logs de Construction</h1>
<ul>
{allLogEntries.map(entry => (
<li>
<a href={`/logs/${entry.slug}`}>{entry.data.title}</a>
<p>Publié le: {entry.data.publishDate.toLocaleDateString('fr-FR')}</p>
</li>
))}
</ul>
</Layout>