Compare commits

...
3 Commits
Author SHA1 Message Date
davide abeabb3a44 Add the official social marks to the footer links
The marks come from the simple-icons package (CC0) and are inlined at build
time — the earlier hand-drawn glyphs were wrong, the X mark in particular is
not a plain cross. Importing the three SVGs individually rather than the
package index keeps the other icons out of the bundle: 10 kB, not 5 MB.

Rendered monochrome in the surrounding text colour, with the text label kept
next to each one.
2026-08-25 16:11:14 +02:00
davide 0229960a15 Add the social profiles to the footer 2026-08-25 15:35:29 +02:00
davide 31dbf56235 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.
2026-08-25 15:30:57 +02:00
15 changed files with 158 additions and 15 deletions

No files matched your search

@@ -8,7 +8,8 @@
"description": "Blog article" "description": "Blog article"
}, },
"options": { "options": {
"draftAndPublish": true "draftAndPublish": true,
"populateCreatorFields": true
}, },
"attributes": { "attributes": {
"title": { "title": {
+38
View File
@@ -0,0 +1,38 @@
<script setup lang="ts">
// The official brand marks, inlined at build time from the simple-icons
// package (CC0) rather than redrawn here. Importing the three files directly
// keeps the other ~3000 icons out of the bundle.
import facebookMark from 'simple-icons/icons/facebook.svg?raw'
import instagramMark from 'simple-icons/icons/instagram.svg?raw'
import xMark from 'simple-icons/icons/x.svg?raw'
const MARKS = {
X: xMark,
Instagram: instagramMark,
Facebook: facebookMark,
} as const
const props = defineProps<{ name: keyof typeof MARKS }>()
const mark = computed(() => MARKS[props.name])
</script>
<template>
<!-- eslint-disable-next-line vue/no-v-html -- build-time asset, not user input -->
<span class="icon" aria-hidden="true" v-html="mark" />
</template>
<style scoped>
.icon {
flex: none;
display: inline-flex;
width: 0.95rem;
height: 0.95rem;
}
.icon :deep(svg) {
width: 100%;
height: 100%;
fill: currentColor;
}
</style>
+28
View File
@@ -72,6 +72,18 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
<li><NuxtLinkLocale to="/blog">{{ $t('site.allArticles') }}</NuxtLinkLocale></li> <li><NuxtLinkLocale to="/blog">{{ $t('site.allArticles') }}</NuxtLinkLocale></li>
</ul> </ul>
</nav> </nav>
<nav class="footer-block" :aria-label="$t('site.follow')">
<p class="kicker">{{ $t('site.follow') }}</p>
<ul>
<li v-for="social in SOCIAL_LINKS" :key="social.name">
<a class="social" :href="social.url" target="_blank" rel="noopener me">
<SocialIcon :name="social.name" />
<span>{{ social.name }}</span>
</a>
</li>
</ul>
</nav>
</div> </div>
<p class="container copyright kicker" :lang="locale"> <p class="container copyright kicker" :lang="locale">
@@ -215,6 +227,22 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
text-underline-offset: 0.2em; text-underline-offset: 0.2em;
} }
.social {
display: inline-flex;
align-items: center;
gap: 0.55rem;
}
/* Keep the underline on the label, not stretched across the icon. */
.social:hover {
text-decoration: none;
}
.social:hover span {
text-decoration: underline;
text-underline-offset: 0.2em;
}
.copyright { .copyright {
padding-top: 1.75rem; padding-top: 1.75rem;
text-align: center; text-align: center;
+12 -3
View File
@@ -39,6 +39,9 @@ useHead({
headline: article.value.title, headline: article.value.title,
description: article.value.summary, description: article.value.summary,
datePublished: isoDate(article.value.publishedAt), datePublished: isoDate(article.value.publishedAt),
author: article.value.author
? { '@type': 'Person', name: article.value.author }
: undefined,
image: cover.value ? [cover.value] : undefined, image: cover.value ? [cover.value] : undefined,
mainEntityOfPage: { '@type': 'WebPage', '@id': canonical }, mainEntityOfPage: { '@type': 'WebPage', '@id': canonical },
}), }),
@@ -64,8 +67,12 @@ useHead({
<p class="kicker date"> <p class="kicker date">
<time :datetime="isoDate(article.publishedAt)"> <time :datetime="isoDate(article.publishedAt)">
{{ formatDate(article.publishedAt, locale) }} {{ formatDateTime(article.publishedAt, locale) }}
</time> </time>
<template v-if="article.author">
<span aria-hidden="true"> · </span>
<span>{{ $t('article.by', { name: article.author }) }}</span>
</template>
</p> </p>
</header> </header>
@@ -90,7 +97,9 @@ useHead({
<style scoped> <style scoped>
.article-header { .article-header {
max-width: 46rem; max-width: 46rem;
margin-inline: auto; /* The gap below the header lives here, not on the cover: an article without
a cover image would otherwise have its body butting against the byline. */
margin: 0 auto 3rem;
text-align: center; text-align: center;
} }
@@ -139,7 +148,7 @@ h1 {
width: 100%; width: 100%;
aspect-ratio: 3 / 2; aspect-ratio: 3 / 2;
object-fit: cover; object-fit: cover;
margin-block: 3rem; margin-block: 0 3rem;
background: var(--color-surface); background: var(--color-surface);
} }
</style> </style>
+4 -2
View File
@@ -10,7 +10,8 @@
"categories": "Categories", "categories": "Categories",
"contact": "Contact", "contact": "Contact",
"noCategories": "Nothing published yet", "noCategories": "Nothing published yet",
"rights": "All rights reserved." "rights": "All rights reserved.",
"follow": "Follow"
}, },
"home": { "home": {
"latest": "Latest", "latest": "Latest",
@@ -38,7 +39,8 @@
}, },
"article": { "article": {
"breadcrumb": "Breadcrumb", "breadcrumb": "Breadcrumb",
"back": "Back to all articles" "back": "Back to all articles",
"by": "By {name}"
}, },
"error": { "error": {
"notFoundTitle": "Page not found", "notFoundTitle": "Page not found",
+4 -2
View File
@@ -10,7 +10,8 @@
"categories": "Categorías", "categories": "Categorías",
"contact": "Contacto", "contact": "Contacto",
"noCategories": "Aún no hay publicaciones", "noCategories": "Aún no hay publicaciones",
"rights": "Todos los derechos reservados." "rights": "Todos los derechos reservados.",
"follow": "Síguenos"
}, },
"home": { "home": {
"latest": "Último", "latest": "Último",
@@ -38,7 +39,8 @@
}, },
"article": { "article": {
"breadcrumb": "Ruta de navegación", "breadcrumb": "Ruta de navegación",
"back": "Volver a todos los artículos" "back": "Volver a todos los artículos",
"by": "Por {name}"
}, },
"error": { "error": {
"notFoundTitle": "Página no encontrada", "notFoundTitle": "Página no encontrada",
+4 -2
View File
@@ -10,7 +10,8 @@
"categories": "Catégories", "categories": "Catégories",
"contact": "Contact", "contact": "Contact",
"noCategories": "Rien n'a encore été publié", "noCategories": "Rien n'a encore été publié",
"rights": "Tous droits réservés." "rights": "Tous droits réservés.",
"follow": "Suivez-nous"
}, },
"home": { "home": {
"latest": "Dernier", "latest": "Dernier",
@@ -38,7 +39,8 @@
}, },
"article": { "article": {
"breadcrumb": "Fil d'Ariane", "breadcrumb": "Fil d'Ariane",
"back": "Retour à tous les articles" "back": "Retour à tous les articles",
"by": "Par {name}"
}, },
"error": { "error": {
"notFoundTitle": "Page introuvable", "notFoundTitle": "Page introuvable",
+4 -2
View File
@@ -10,7 +10,8 @@
"categories": "Categorie", "categories": "Categorie",
"contact": "Contatti", "contact": "Contatti",
"noCategories": "Ancora nessuna pubblicazione", "noCategories": "Ancora nessuna pubblicazione",
"rights": "Tutti i diritti riservati." "rights": "Tutti i diritti riservati.",
"follow": "Seguici"
}, },
"home": { "home": {
"latest": "Ultimo", "latest": "Ultimo",
@@ -38,7 +39,8 @@
}, },
"article": { "article": {
"breadcrumb": "Percorso di navigazione", "breadcrumb": "Percorso di navigazione",
"back": "Torna a tutti gli articoli" "back": "Torna a tutti gli articoli",
"by": "Di {name}"
}, },
"error": { "error": {
"notFoundTitle": "Pagina non trovata", "notFoundTitle": "Pagina non trovata",
+20
View File
@@ -10,6 +10,7 @@
"@nuxtjs/i18n": "^10.6.0", "@nuxtjs/i18n": "^10.6.0",
"marked": "^18.0.11", "marked": "^18.0.11",
"nuxt": "^4.5.2", "nuxt": "^4.5.2",
"simple-icons": "^16.28.0",
"vue": "^3.5.41", "vue": "^3.5.41",
"vue-router": "^5.2.0" "vue-router": "^5.2.0"
}, },
@@ -10241,6 +10242,25 @@
"url": "https://github.com/steveukx/git-js?sponsor=1" "url": "https://github.com/steveukx/git-js?sponsor=1"
} }
}, },
"node_modules/simple-icons": {
"version": "16.28.0",
"resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-16.28.0.tgz",
"integrity": "sha512-sQPR5AtK/ijRjou7zw7mlLp08oB6FH7i0lOy5XJ2zp9mJs/yejgiOn7KvQoe2q4YJIx6VmgUSW5AOefebPt5kg==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/simple-icons"
},
{
"type": "github",
"url": "https://github.com/sponsors/simple-icons"
}
],
"license": "CC0-1.0",
"engines": {
"node": ">=0.12.18"
}
},
"node_modules/sirv": { "node_modules/sirv": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz",
+1
View File
@@ -14,6 +14,7 @@
"@nuxtjs/i18n": "^10.6.0", "@nuxtjs/i18n": "^10.6.0",
"marked": "^18.0.11", "marked": "^18.0.11",
"nuxt": "^4.5.2", "nuxt": "^4.5.2",
"simple-icons": "^16.28.0",
"vue": "^3.5.41", "vue": "^3.5.41",
"vue-router": "^5.2.0" "vue-router": "^5.2.0"
}, },
+22 -3
View File
@@ -1,6 +1,20 @@
import type { Article } from '#shared/types/blog' import type { Article } from '#shared/types/blog'
type RawArticle = Omit<Article, 'html' | 'summary'> & { content: string | null } interface AdminUser {
firstname: string | null
lastname: string | null
}
type RawArticle = Omit<Article, 'html' | 'summary' | 'author'> & {
content: string | null
createdBy?: AdminUser | null
}
/** Joins the admin user's name parts; returns null when neither is set. */
function byline(user: AdminUser | null | undefined): string | null {
const name = [user?.firstname, user?.lastname].filter(Boolean).join(' ').trim()
return name || null
}
export default defineEventHandler(async (event): Promise<Article> => { export default defineEventHandler(async (event): Promise<Article> => {
const slug = getRouterParam(event, 'slug') const slug = getRouterParam(event, 'slug')
@@ -19,6 +33,11 @@ export default defineEventHandler(async (event): Promise<Article> => {
throw createError({ statusCode: 404, statusMessage: 'Article not found' }) throw createError({ statusCode: 404, statusMessage: 'Article not found' })
} }
const { content, ...rest } = article const { content, createdBy, ...rest } = article
return { ...rest, html: renderMarkdown(content), summary: summarise(content) } return {
...rest,
html: renderMarkdown(content),
summary: summarise(content),
author: byline(createdBy),
}
}) })
+3
View File
@@ -16,6 +16,9 @@ export const ARTICLE_DETAIL_QUERY = [
list('fields', ['title', 'slug', 'content', 'publishedAt']), list('fields', ['title', 'slug', 'content', 'publishedAt']),
list('populate[cover][fields]', IMAGE_FIELDS), list('populate[cover][fields]', IMAGE_FIELDS),
list('populate[category][fields]', ['name', 'slug']), list('populate[category][fields]', ['name', 'slug']),
// The byline is the admin user who created the entry; Strapi exposes the
// name fields only because the content type sets populateCreatorFields.
list('populate[createdBy][fields]', ['firstname', 'lastname']),
].join('&') ].join('&')
export const PAGE_SIZE = 12 export const PAGE_SIZE = 12
+2
View File
@@ -26,6 +26,8 @@ export interface Article extends ArticleSummary {
html: string html: string
/** Plain-text opening of the body, used as the meta description. */ /** Plain-text opening of the body, used as the meta description. */
summary: string summary: string
/** Byline: the full name of the admin user who wrote the article. */
author: string | null
} }
export interface Paginated<T> { export interface Paginated<T> {
+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)) 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. */ /** Machine-readable date for the `datetime` attribute and structured data. */
export function isoDate(value: string | null | undefined): string { export function isoDate(value: string | null | undefined): string {
return value ? new Date(value).toISOString() : '' return value ? new Date(value).toISOString() : ''
+7
View File
@@ -3,3 +3,10 @@ export const SITE_NAME = 'CorralitoComing'
/** Public contact address, shown in the footer. */ /** Public contact address, shown in the footer. */
export const SITE_EMAIL = 'corralitocoming@gmail.com' export const SITE_EMAIL = 'corralitocoming@gmail.com'
/** Social profiles listed in the footer. Names are brands, so untranslated. */
export const SOCIAL_LINKS = [
{ name: 'X', url: 'https://x.com/CORRALITOCOMING' },
{ name: 'Instagram', url: 'https://www.instagram.com/corralitocoming' },
{ name: 'Facebook', url: 'https://www.facebook.com/share/1JwXwQWyQA/' },
] as const