feat: profile_url auteur → article:author URL + JSON-LD author.url

This commit is contained in:
Cedric Abonnel
2026-05-12 23:45:41 +02:00
parent a031ea960e
commit e1c179b536
6 changed files with 53 additions and 16 deletions
+11 -5
View File
@@ -43,8 +43,9 @@ $externalLinks = $article['external_links'] ?? [];
<div class="private-ribbon">Privé</div>
<?php endif; ?>
<?php
$authorEmail = $article['author'] ?? '';
$authorName = ($authorEmail !== '' && function_exists('authorDisplayName')) ? authorDisplayName($authorEmail) : '';
$authorEmail = $article['author'] ?? '';
$authorName = ($authorEmail !== '' && function_exists('authorDisplayName')) ? authorDisplayName($authorEmail) : '';
$authorProfileUrl = ($authorEmail !== '' && function_exists('authorProfileUrl')) ? authorProfileUrl($authorEmail) : '';
$pubDate = htmlspecialchars(date('d/m/Y', strtotime((string)($article['published_at'] ?? $article['created_at'] ?? ''))));
$hasCover = $coverFile !== '';
$heroExtraClass = $hasCover ? '' : ' article-cover--gradient';
@@ -281,8 +282,9 @@ if ($ogImage === null || $ogImage === '') {
$ogImage = $article['og_image'] ?? '';
}
// Auteur : nom affiché résolu depuis le champ author du JSON de l'article
$metaAuthor = $authorName;
// Auteur : nom et URL de profil résolus depuis le champ author du JSON de l'article
$metaAuthor = $authorName;
$metaAuthorUrl = $authorProfileUrl;
// JSON-LD Article
$jsonLdData = [
@@ -293,7 +295,11 @@ $jsonLdData = [
'url' => $canonical,
'datePublished' => date('c', strtotime((string)$articlePublishedAt)),
'dateModified' => date('c', strtotime((string)($article['updated_at'] ?? $articlePublishedAt))),
'author' => ['@type' => 'Person', 'name' => $metaAuthor !== '' ? $metaAuthor : (siteAuthor() !== '' ? siteAuthor() : siteTitle())],
'author' => array_filter([
'@type' => 'Person',
'name' => $metaAuthor !== '' ? $metaAuthor : (siteAuthor() !== '' ? siteAuthor() : siteTitle()),
'url' => $metaAuthorUrl !== '' ? $metaAuthorUrl : null,
]),
'publisher' => [
'@type' => 'Person',
'name' => siteAuthor() !== '' ? siteAuthor() : siteTitle(),