Add Open Graph and Twitter Card meta tags to all public pages

- templates/public/head.php: add centralised OG/Twitter tag rendering via $ogTags array;
  supports type, title, description, url, image, image_alt, site_name, article_author,
  article_published_time; twitter:card switches between summary_large_image / summary
  based on presence of og:image

- public/tfe.php: populate full article OG tags — og:type=article, canonical URL,
  og:image resolved from banner_path → first image file in thesis_files → omitted,
  og:image:alt, article:author, article:published_time (year-01-01); twitter:card
  summary_large_image when image present

- public/index.php, search.php, apropos.php, licence.php: add basic og:type=website
  tags (title, description, canonical url, site_name)

Sharing a thesis link on Slack, WhatsApp, iMessage, or any social platform will now
render a rich preview card with the thesis title, synopsis excerpt, and cover/banner image.
This commit is contained in:
Pontoporeia
2026-03-29 15:43:21 +02:00
parent 1dee1ea73f
commit 3a8ffa6afe
7 changed files with 105 additions and 3 deletions

View File

@@ -22,6 +22,13 @@ $html = $pd->text($content);
$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.';
$ogTags = [
'type' => 'website',
'title' => $pageTitle,
'description' => $metaDescription,
'url' => 'https://posterg.erg.be/licence.php',
'site_name' => 'Posterg ERG',
];
$extraCss = ['assets/apropos.css'];
?>
<?php include APP_ROOT . '/templates/public/head.php'; ?>