Add <meta name=description> to all public pages; improve page titles

- templates/public/head.php: emit <meta name="description"> when $metaDescription is set
- index.php: title → 'Posterg – Mémoires de l\'ERG'; description = site blurb
- tfe.php: title → '[Titre] – [Auteur] – Posterg'; description = synopsis excerpt (strip_tags, truncate 160)
- search.php: description = répertoire purpose blurb
- apropos.php: description = about-page blurb
- licence.php: description = licences blurb

Fixes WCAG 2.4.2 (Page Titled) for index.php and tfe.php.
All descriptions properly htmlspecialchars-escaped at render time.
This commit is contained in:
Pontoporeia
2026-03-28 19:38:21 +01:00
parent 5c00886db6
commit 1dee1ea73f
8 changed files with 18 additions and 4 deletions

View File

@@ -17,7 +17,14 @@ if (isset($_GET['id'])) {
}
$currentNav = '';
$pageTitle = $data['title'] . ' Posterg';
$_tfeAuthor = $data['authors'] ?? '';
$pageTitle = $data['title'] . (!empty($_tfeAuthor) ? ' ' . $_tfeAuthor : '') . ' Posterg';
// Build meta description: strip markdown/HTML from synopsis, truncate to ~160 chars
$_synopsisRaw = strip_tags($data['synopsis'] ?? '');
$metaDescription = mb_strlen($_synopsisRaw) > 160
? mb_substr($_synopsisRaw, 0, 157) . '…'
: (empty($_synopsisRaw) ? 'Mémoire de fin d\'études Posterg, répertoire des TFE de l\'erg.' : $_synopsisRaw);
unset($_tfeAuthor, $_synopsisRaw);
$extraCss = ['assets/tfe.css'];
?>
<?php include APP_ROOT . '/templates/public/head.php'; ?>