fix: link post authors by slug, not by login

This commit is contained in:
Jakub Zych
2026-10-31 13:13:38 +01:00
parent 102da43f76
commit 1dd3176060
6 changed files with 39 additions and 17 deletions

View File

@@ -11,9 +11,15 @@ const links = useJournalLinks()
const date = computed(() => formatJournalDate(props.post.published_at, localeProperties.value.language ?? 'en'))
const authorName = computed(() => {
const a = props.post.author
return a ? `${a.first_name} ${a.last_name}`.trim() || a.login : ''
return a ? `${a.first_name} ${a.last_name}`.trim() || a.slug || a.login : ''
})
// By slug, so the link does not carry the login (often an email address).
// An API before sm-journal-plugin v0.3.1 sends no slug; the login still
// resolves there.
const authorHref = computed(() => {
const a = props.post.author
return a ? links.authorLink(a.slug || a.login) : null
})
const authorHref = computed(() => (props.post.author ? links.authorLink(props.post.author.login) : null))
</script>
<template>