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

@@ -534,7 +534,7 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis
`<form>` and no `<label>` for the input (only a placeholder). Add `aria-label="Recherche"` to `<form>` and no `<label>` for the input (only a placeholder). Add `aria-label="Recherche"` to
the `<form>` element; also add `role="search"`, a visually-hidden `<label>` linked via `for`/`id`. the `<form>` element; also add `role="search"`, a visually-hidden `<label>` linked via `for`/`id`.
- [ ] **No `<meta name="description">` on any public page** - all public pages omit the description - [x] **No `<meta name="description">` on any public page** - all public pages omit the description
meta tag (the dead `templates/head.php` had `content=""`). Add per-page descriptions: meta tag (the dead `templates/head.php` had `content=""`). Add per-page descriptions:
site blurb for `index.php`, synopsis excerpt for `tfe.php`, page content intro for site blurb for `index.php`, synopsis excerpt for `tfe.php`, page content intro for
`apropos.php`/`licence.php`. Necessary for search indexing and link preview cards. `apropos.php`/`licence.php`. Necessary for search indexing and link preview cards.
@@ -1100,7 +1100,7 @@ Current state: **zero ARIA attributes, zero skip links, zero focus-visible style
#### 2.4.2 Page titled #### 2.4.2 Page titled
- [ ] **`index.php` `<title>` is just "Posterg"** - no description of the page content. - [x] **`index.php` `<title>` is just "Posterg"** - no description of the page content.
Change to "Posterg - Mémoires de l'ERG" or similar. Each page title should be unique and Change to "Posterg - Mémoires de l'ERG" or similar. Each page title should be unique and
descriptive first: "Répertoire - Posterg", "À Propos - Posterg" (already good), but descriptive first: "Répertoire - Posterg", "À Propos - Posterg" (already good), but
`tfe.php` uses just the thesis title without author: add author - "[Titre] - [Auteur] - Posterg". `tfe.php` uses just the thesis title without author: add author - "[Titre] - [Auteur] - Posterg".

View File

@@ -25,6 +25,7 @@ $pd = new Parsedown();
$pd->setSafeMode(true); $pd->setSafeMode(true);
$aboutHtml = $pd->text($rawContent); $aboutHtml = $pd->text($rawContent);
$pageTitle = 'À Propos Posterg'; $pageTitle = 'À Propos Posterg';
$metaDescription = 'À propos de Posterg, le répertoire des mémoires de fin d\'études de l\'erg École de Recherches Graphiques de Bruxelles.';
$extraCss = ['assets/apropos.css']; $extraCss = ['assets/apropos.css'];
?> ?>
<?php include APP_ROOT . '/templates/public/head.php'; ?> <?php include APP_ROOT . '/templates/public/head.php'; ?>

View File

@@ -50,7 +50,8 @@ try {
} }
$currentNav = ''; $currentNav = '';
$pageTitle = 'Posterg'; $pageTitle = 'Posterg Mémoires de l\'ERG';
$metaDescription = 'Posterg répertorie et valorise les mémoires de fin d\'études (TFE) de l\'erg École de Recherches Graphiques de Bruxelles.';
$extraCss = ['assets/main.css']; $extraCss = ['assets/main.css'];
?> ?>
<?php include APP_ROOT . '/templates/public/head.php'; ?> <?php include APP_ROOT . '/templates/public/head.php'; ?>

View File

@@ -21,6 +21,7 @@ $pd->setSafeMode(true);
$html = $pd->text($content); $html = $pd->text($content);
$pageTitle = $licencePageTitle . ' Posterg'; $pageTitle = $licencePageTitle . ' Posterg';
$metaDescription = 'Informations sur les licences d\'utilisation des mémoires publiés sur Posterg, le répertoire des TFE de l\'erg.';
$extraCss = ['assets/apropos.css']; $extraCss = ['assets/apropos.css'];
?> ?>
<?php include APP_ROOT . '/templates/public/head.php'; ?> <?php include APP_ROOT . '/templates/public/head.php'; ?>

View File

@@ -62,6 +62,7 @@ try {
$currentNav = 'repertoire'; $currentNav = 'repertoire';
$searchBarValue = $_GET['query'] ?? ''; $searchBarValue = $_GET['query'] ?? '';
$pageTitle = 'Répertoire Posterg'; $pageTitle = 'Répertoire Posterg';
$metaDescription = 'Parcourez le répertoire des mémoires de fin d\'études (TFE) de l\'erg École de Recherches Graphiques de Bruxelles. Recherche par année, orientation, atelier et mots-clés.';
$extraCss = ['assets/search.css']; $extraCss = ['assets/search.css'];
?> ?>
<?php include APP_ROOT . '/templates/public/head.php'; ?> <?php include APP_ROOT . '/templates/public/head.php'; ?>

View File

@@ -17,7 +17,14 @@ if (isset($_GET['id'])) {
} }
$currentNav = ''; $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']; $extraCss = ['assets/tfe.css'];
?> ?>
<?php include APP_ROOT . '/templates/public/head.php'; ?> <?php include APP_ROOT . '/templates/public/head.php'; ?>

Binary file not shown.

View File

@@ -4,6 +4,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($pageTitle ?? 'Posterg') ?></title> <title><?= htmlspecialchars($pageTitle ?? 'Posterg') ?></title>
<?php if (!empty($metaDescription)): ?>
<meta name="description" content="<?= htmlspecialchars($metaDescription) ?>">
<?php endif; ?>
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg"> <link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
<link rel="stylesheet" href="assets/modern-normalize.min.css"> <link rel="stylesheet" href="assets/modern-normalize.min.css">
<link rel="stylesheet" href="assets/common.css"> <link rel="stylesheet" href="assets/common.css">