Restructuration sections, contenu administrable, shadoks, palette été
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Structure par section : /numerique, /economique, /citoyenne (plus de /gestation) - Chaque section a index + sous-pages avec contenu YAML administrable - API content supporte les chemins imbriqués ([...path]) - Admin : liste des pages + éditeur par section - Page /economique : monnaie libre (picto Ğ1), modèle éco, productions collectives, commande livre - Page /citoyenne : decision (CTA Glibredecision), tarifs-eau (CTA SejeteralO) - BookActions : composant partagé (player, PDF, chapitres, commande) sur home, eco et modele-eco - GrateWizard remonté dans la section économique de la home - Palette été par défaut, choix persisté en localStorage - Fix lisibilité été (text-white/65 + variables CSS) - Shadoks thématiques sur toutes les pages (8-10 par page, métiers variés) - Redirections 301 : /gestation/*, /modele-eco/*, /decision, /lire/* - README, CONTRIBUTING, CLAUDE.md mis à jour Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
server/api/admin/content/pages.get.ts
Normal file
39
server/api/admin/content/pages.get.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { readdir, stat } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
|
||||
interface PageEntry {
|
||||
path: string
|
||||
label: string
|
||||
section?: string
|
||||
}
|
||||
|
||||
async function listYamlFiles(dir: string, prefix = ''): Promise<PageEntry[]> {
|
||||
const entries: PageEntry[] = []
|
||||
const items = await readdir(dir)
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = join(dir, item)
|
||||
const s = await stat(fullPath)
|
||||
|
||||
if (s.isDirectory()) {
|
||||
const subEntries = await listYamlFiles(fullPath, prefix ? `${prefix}/${item}` : item)
|
||||
entries.push(...subEntries)
|
||||
}
|
||||
else if (item.endsWith('.yml')) {
|
||||
const name = item.replace('.yml', '')
|
||||
const path = prefix ? `${prefix}/${name}` : name
|
||||
entries.push({
|
||||
path,
|
||||
label: name,
|
||||
section: prefix || undefined,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return entries
|
||||
}
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
const pagesDir = join(process.cwd(), 'site', 'pages')
|
||||
return await listYamlFiles(pagesDir)
|
||||
})
|
||||
Reference in New Issue
Block a user