Restructuration sections, contenu administrable, shadoks, palette été
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:
Yvv
2026-03-14 16:13:46 +01:00
parent c564e7be5f
commit 9caf11c8ab
48 changed files with 4576 additions and 1071 deletions

View 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)
})

View File

@@ -0,0 +1,21 @@
import { mkdir } from 'node:fs/promises'
import { join, dirname } from 'node:path'
export default defineEventHandler(async (event) => {
const path = getRouterParam(event, 'path')
if (!path || !/^[a-z0-9-/]+$/.test(path)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid page path' })
}
const body = await readBody(event)
const relativePath = `pages/${path}.yml`
// Ensure subdirectory exists
const fullPath = join(process.cwd(), 'site', relativePath)
await mkdir(dirname(fullPath), { recursive: true })
await writeYaml(relativePath, body)
gitSyncContent(`Mise à jour page ${path}`, [`site/${relativePath}`])
return { ok: true }
})

View File

@@ -1,12 +0,0 @@
export default defineEventHandler(async (event) => {
const name = getRouterParam(event, 'name')
if (!name || !/^[a-z0-9-]+$/.test(name)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid page name' })
}
const body = await readBody(event)
await writeYaml(`pages/${name}.yml`, body)
gitSyncContent(`Mise à jour page ${name}`, [`site/pages/${name}.yml`])
return { ok: true }
})

View File

@@ -1,14 +1,14 @@
export default defineEventHandler(async (event) => {
const name = getRouterParam(event, 'name')
const path = getRouterParam(event, 'path')
if (!name || !/^[a-z0-9-]+$/.test(name)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid page name' })
if (!path || !/^[a-z0-9-/]+$/.test(path)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid page path' })
}
try {
return await readYaml(`pages/${name}.yml`)
return await readYaml(`pages/${path}.yml`)
}
catch {
throw createError({ statusCode: 404, statusMessage: `Page "${name}" not found` })
throw createError({ statusCode: 404, statusMessage: `Page "${path}" not found` })
}
})

View File

@@ -1,9 +1,10 @@
export default defineEventHandler((event) => {
const path = getRequestURL(event).pathname
// /lire → /economique/modele-eco
if (path.startsWith('/lire')) {
const rest = path.slice(5) // remove '/lire'
return sendRedirect(event, `/modele-eco${rest || '/'}`, 301)
return sendRedirect(event, `/economique/modele-eco${rest || '/'}`, 301)
}
if (path.startsWith('/ecouter')) {
@@ -14,4 +15,31 @@ export default defineEventHandler((event) => {
if (path === '/autonomie' || path === '/autonomie/') {
return sendRedirect(event, '/numerique', 301)
}
if (path === '/decision' || path === '/decision/') {
return sendRedirect(event, '/citoyenne/decision', 301)
}
// /modele-eco → /economique/modele-eco
if (path.startsWith('/modele-eco')) {
const rest = path.slice(11) // remove '/modele-eco'
return sendRedirect(event, `/economique/modele-eco${rest || '/'}`, 301)
}
// Redirect old /gestation/* routes to proper sections
if (path.startsWith('/gestation/')) {
const slug = path.slice(11).replace(/\/$/, '')
const numeriquePages = ['logiciel-libre', 'authentification-wot', 'cloud-libre']
if (numeriquePages.includes(slug)) {
return sendRedirect(event, `/numerique/${slug}`, 301)
}
if (slug === 'productions-collectives') {
return sendRedirect(event, '/economique/productions-collectives', 301)
}
if (slug === 'tarifs-eau') {
return sendRedirect(event, '/citoyenne/tarifs-eau', 301)
}
// Fallback
return sendRedirect(event, '/', 301)
}
})