[Nom du Layout]
Type de ressource : Layout Astro (Gabarit de page)
Fichier source :src/layouts/[NomLayout].astro
Statut : [Actif / Déprécié / En développement]
Slice : [Numéro de la tranche verticale]
Version : 1.0
1. Vue dâensemble (DOC)
Section titled â1. Vue dâensemble (DOC)â1.1. Description
Section titled â1.1. Descriptionâ[Description concise du rĂŽle de ce layout dans lâarchitecture du site]
1.2. Objectif
Section titled â1.2. Objectifâ- [Objectif principal : ex. fournir la structure HTML globale pour les pages de blog]
- [BĂ©nĂ©fice pour lâarchitecture : ex. cohĂ©rence visuelle + SEO centralisĂ©]
1.3. PérimÚtre concerné
Section titled â1.3. PĂ©rimĂštre concernĂ©â| Type de pages | Statut |
|---|---|
| Blog | [â /â] |
| Portfolio | [â /â] |
| Vitrine | [â /â] |
| Documentation | [â /â] |
| Toutes | [â /â] |
| Mode de rendu | Statut |
|---|---|
| SSG | [â /â] |
| SSR | [â /â] |
| Les deux | [â /â] |
2. Architecture et structure (DOC)
Section titled â2. Architecture et structure (DOC)â2.1. Diagramme de flux
Section titled â2.1. Diagramme de fluxâ[Page Astro] â (import du layout) âŒ[Layout] â âą Structure HTML globale â âą Injection des mĂ©tadonnĂ©es SEO â âą Inclusion des composants globaux (Header, Footer) â âą Gestion des slots de contenu âŒ[HTML final]2.2. Composants impliquĂ©s
Section titled â2.2. Composants impliquĂ©sâ| Composant | RĂŽle | Fichier |
|---|---|---|
| Layout parent | Structure HTML de base | src/layouts/BaseLayout.astro (si applicable) |
| Header | Navigation globale | src/components/ui/Header.astro |
| Footer | Pied de page global | src/components/ui/Footer.astro |
| SEO Component | Injection des balises meta | src/components/seo/SeoJsonLd.astro |
| Slot de contenu | Zone de contenu dynamique | <slot /> |
3. Implémentation (CODE)
Section titled â3. ImplĂ©mentation (CODE)â3.1. Code du layout
Section titled â3.1. Code du layoutâ---import BaseLayout from './BaseLayout.astro';import Header from '../components/ui/Header.astro';import Footer from '../components/ui/Footer.astro';import SeoJsonLd from '../components/seo/SeoJsonLd.astro';
interface Props { title: string; description?: string; ogImage?: string; canonical?: string; jsonLd?: object;}
const { title, description, ogImage, canonical = Astro.url.href, jsonLd} = Astro.props;---
<BaseLayout title={title} description={description} ogImage={ogImage}} <Header />
<main id="main-content"> <slot /> </main>
<Footer />
{jsonLd && <SeoJsonLd data={jsonLd} />}</BaseLayout>3.2. Variante : Layout avec sidebar
Section titled â3.2. Variante : Layout avec sidebarâ---import BaseLayout from './BaseLayout.astro';import Header from '../components/ui/Header.astro';import Footer from '../components/ui/Footer.astro';import Sidebar from '../components/ui/Sidebar.astro';
interface Props { title: string; description?: string;}
const { title, description } = Astro.props;---
<BaseLayout title={title} description={description}> <Header />
<div class="flex"> <aside class="w-64"> <Sidebar /> </aside>
<main id="main-content" class="flex-1"> <slot /> </main> </div>
<Footer /></BaseLayout>4. Contrats dâEntrĂ©e/Sortie (SPEC)
Section titled â4. Contrats dâEntrĂ©e/Sortie (SPEC)â4.1. Inputs (Props)
Section titled â4.1. Inputs (Props)â| Prop | Type | Obligatoire | Validation |
|---|---|---|---|
title |
string |
â | Non vide |
description |
string |
â | Valeur par dĂ©faut |
ogImage |
string |
â | URL valide |
canonical |
string |
â | URL valide |
jsonLd |
object |
â | Structure JSON-LD valide |
4.2. Outputs (HTML)
Section titled â4.2. Outputs (HTML)â| ĂlĂ©ment | Type | Description |
|---|---|---|
| HTML structure | HTMLElement |
Structure HTML complĂšte |
| Meta tags | HTMLMetaElement |
Balises SEO |
| Slot content | HTMLElement |
Contenu injecté |
5. Tests attendus (TEST)
Section titled â5. Tests attendus (TEST)â5.1. Tests unitaires
Section titled â5.1. Tests unitairesâ| ScĂ©nario | Description | RĂ©sultat attendu |
|---|---|---|
| Rendu avec props | Props valides | Layout rendu correctement |
| Injection SEO | Meta tags | Balises injectées |
| Slot content | Contenu injecté | Slot rendu correctement |
5.2. Tests dâintĂ©gration
Section titled â5.2. Tests dâintĂ©grationâ| ScĂ©nario | DĂ©pendances | Description | RĂ©sultat attendu |
|---|---|---|---|
| Intégration page | Page + Layout | Page utilise le layout | Structure correcte |
5.3. Tests E2E
Section titled â5.3. Tests E2Eâ| ScĂ©nario | Parcours utilisateur | Description | RĂ©sultat attendu |
|---|---|---|---|
| Navigation | Utilisateur â Page | Navigation sur le site | Layout cohĂ©rent |
6. IntĂ©gration (INTĂG)
Section titled â6. IntĂ©gration (INTĂG)â6.1. IntĂ©gration avec les composants
Section titled â6.1. IntĂ©gration avec les composantsâ| Composant | Type | RĂŽle | MĂ©thode dâintĂ©gration |
|---|---|---|---|
| Page | L2 | Utilisation du layout | Import et wrapper |
| Header | L2 | Navigation globale | Import et rendu |
| Footer | L2 | Pied de page | Import et rendu |
6.2. Points dâattention
Section titled â6.2. Points dâattentionâ- Les props doivent ĂȘtre typĂ©es avec TypeScript
- Le SEO doit ĂȘtre centralisĂ© dans le layout
- LâaccessibilitĂ© doit ĂȘtre conforme WCAG AA
6.3. Vérification de cohérence
Section titled â6.3. VĂ©rification de cohĂ©renceâ- Le layout fonctionne avec toutes les pages
- Les meta tags sont injectés correctement
- LâaccessibilitĂ© est conforme
- Les tests E2E passent
7. Sécurité
Section titled â7. SĂ©curitĂ©â7.1. MĂ©canismes de sĂ©curitĂ©
Section titled â7.1. MĂ©canismes de sĂ©curitĂ©â- â CSP headers appliquĂ©s par le middleware
- â Validation des props
- â Protection XSS (Astro par dĂ©faut)
7.2. RÚgles de sécurité
Section titled â7.2. RĂšgles de sĂ©curitĂ©â- â Ne jamais exposer de donnĂ©es sensibles dans le HTML
- â Valider toutes les URLs (canonical, ogImage)
- â Utiliser les en-tĂȘtes de sĂ©curitĂ© appropriĂ©s
8. Performance et limites
Section titled â8. Performance et limitesâ8.1. Optimisations
Section titled â8.1. Optimisationsâ| Optimisation | Description |
|---|---|
| Lazy loading | Chargement différé des composants |
| Code splitting | Séparation du code par layout |
| Critical CSS | CSS critique inline |
8.2. Limitations
Section titled â8.2. Limitationsâ- â Les layouts augmentent la taille du bundle
- â Les slots complexes peuvent affecter les performances
9. Débogage et troubleshooting
Section titled â9. DĂ©bogage et troubleshootingâ9.1. ProblĂšmes courants
Section titled â9.1. ProblĂšmes courantsâ| SymptĂŽme | Cause probable | Solution |
|---|---|---|
| Layout non appliquĂ© | Import incorrect | VĂ©rifier lâimport |
| Meta tags manquants | Props non passées | Vérifier les props |
| Slot vide | Contenu non injecté | Vérifier le slot |
9.2. Commandes de debug
Section titled â9.2. Commandes de debugâ# Build localnpm run build
# Preview du buildnpm run preview10. Bonnes pratiques
Section titled â10. Bonnes pratiquesâ10.1. Architecture
Section titled â10.1. Architectureâ- â Layouts hiĂ©rarchiques (BaseLayout â Layout spĂ©cifique)
- â Props typĂ©es avec TypeScript
- â SEO centralisĂ©
10.2. Code
Section titled â10.2. Codeâ- â Utiliser des composants rĂ©utilisables
- â Optimiser les images et les assets
- â Documenter les props complexes
10.3. Maintenance
Section titled â10.3. Maintenanceâ- â Documenter les changements dans ce fichier
- â Tester les modifications en local
11. Ăvolutions et roadmap
Section titled â11. Ăvolutions et roadmapâ11.1. AmĂ©liorations planifiĂ©es
Section titled â11.1. AmĂ©liorations planifiĂ©esâ- [Ăvolution 1]
- [Ăvolution 2]
11.2. Limitations connues
Section titled â11.2. Limitations connuesâ- â [Limitation 1]
- â [Limitation 2]
12. Ressources liées
Section titled â12. Ressources liĂ©esâ- Documentation Astro : Layouts
- DAT L2 : §5.3 - Structure du Projet
13. Historique des modifications
Section titled â13. Historique des modificationsâ| Date | Version | Description | Auteur |
|---|---|---|---|
| YYYY-MM-DD | 1.0 | Création initiale | [Nom] |