Show the author and publication time on articles

Strapi already records which admin user created an entry, so the byline needs
no extra field to fill in: the Article content type sets populateCreatorFields
and the API layer exposes only that user's firstname and lastname. The name
also feeds the BlogPosting structured data.

Also fixes the gap below the article header, which until now came from the
cover image's margin and therefore vanished on articles without a cover,
leaving the body text against the byline.
This commit is contained in:
2026-08-25 15:30:57 +02:00
parent c08f53ca69
commit 31dbf56235
10 changed files with 56 additions and 11 deletions
+7
View File
@@ -4,6 +4,13 @@ export function formatDate(value: string | null | undefined, locale = 'en-GB'):
return new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(new Date(value))
}
/** Date and time of publication, shown in the article byline. */
export function formatDateTime(value: string | null | undefined, locale = 'en-GB'): string {
if (!value) return ''
return new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeStyle: 'short' })
.format(new Date(value))
}
/** Machine-readable date for the `datetime` attribute and structured data. */
export function isoDate(value: string | null | undefined): string {
return value ? new Date(value).toISOString() : ''