feat: profile_url auteur → article:author URL + JSON-LD author.url
This commit is contained in:
@@ -28,7 +28,9 @@
|
||||
<?php if (!empty($articlePublishedAt ?? '')): ?>
|
||||
<meta property="article:published_time" content="<?= htmlspecialchars(date('c', strtotime((string)$articlePublishedAt))) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($metaAuthor ?? '')): ?>
|
||||
<?php if (!empty($metaAuthorUrl ?? '')): ?>
|
||||
<meta property="article:author" content="<?= htmlspecialchars($metaAuthorUrl) ?>">
|
||||
<?php elseif (!empty($metaAuthor ?? '')): ?>
|
||||
<meta property="article:author" content="<?= htmlspecialchars($metaAuthor) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
+11
-5
@@ -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(),
|
||||
|
||||
@@ -24,6 +24,14 @@
|
||||
placeholder="Prénom Nom" required>
|
||||
<div class="form-text">Affiché comme auteur sur vos articles.</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold" for="profile_url">URL de profil</label>
|
||||
<input type="url" id="profile_url" name="profile_url"
|
||||
class="form-control"
|
||||
value="<?= htmlspecialchars($profileCurrentUrl) ?>"
|
||||
placeholder="https://example.com/~vous">
|
||||
<div class="form-text">Utilisée dans les métadonnées de vos articles (article:author, JSON-LD).</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold text-muted">Email</label>
|
||||
<input type="text" class="form-control" value="<?= htmlspecialchars(currentUserEmail() ?? '') ?>" disabled>
|
||||
|
||||
Reference in New Issue
Block a user