태그 없는 게시물에서 POST 더미 표시 제거(v1.1.2)
This commit is contained in:
@@ -23,12 +23,22 @@ if (!post.value) {
|
||||
|
||||
const primaryTagSlug = computed(() => post.value.tags?.[0] || '')
|
||||
const primaryTagMeta = computed(() => {
|
||||
const matchedTag = tags.value.find((item) => item.slug === primaryTagSlug.value)
|
||||
const slug = primaryTagSlug.value
|
||||
|
||||
if (!slug) {
|
||||
return {
|
||||
name: '',
|
||||
color: '',
|
||||
to: '/tags'
|
||||
}
|
||||
}
|
||||
|
||||
const matchedTag = tags.value.find((item) => item.slug === slug)
|
||||
|
||||
return {
|
||||
name: matchedTag?.name || (primaryTagSlug.value ? primaryTagSlug.value.toUpperCase() : 'POST'),
|
||||
name: matchedTag?.name || slug.toUpperCase(),
|
||||
color: matchedTag?.color || '#4d4d4d',
|
||||
to: primaryTagSlug.value ? `/tag/${primaryTagSlug.value}` : '/tags'
|
||||
to: `/tag/${slug}`
|
||||
}
|
||||
})
|
||||
|
||||
@@ -228,8 +238,8 @@ useHead(() => ({
|
||||
{{ authorLabel }}
|
||||
</a>
|
||||
|
||||
<ul class="flex flex-wrap items-center font-medium">
|
||||
<li v-if="primaryTagMeta.name" :style="{ '--color-accent': primaryTagMeta.color }">
|
||||
<ul v-if="primaryTagSlug" class="flex flex-wrap items-center font-medium">
|
||||
<li :style="{ '--color-accent': primaryTagMeta.color }">
|
||||
<NuxtLink
|
||||
class="rounded-sm px-1.5 py-px text-[var(--site-text)] hover:opacity-75"
|
||||
:style="{ backgroundColor: `${primaryTagMeta.color}1a` }"
|
||||
|
||||
Reference in New Issue
Block a user