🔍 Improve post page SEO

This commit is contained in:
LittleSheep 2024-09-22 18:47:39 +08:00
parent d4e2d74c7b
commit 76d9d18587

View File

@ -106,8 +106,8 @@ if (!post.value) {
navigateTo(`/posts/${post.value.area_alias}/${post.value.alias}`) navigateTo(`/posts/${post.value.area_alias}/${post.value.alias}`)
} }
const title = computed(() => post.value.body?.title ? `${post.value.body?.title} from ${post.value.author.nick}` : `Post from ${post.value.author.nick}`) const title = computed(() => post.value.body?.title ? `${post.value.body?.title} by @${post.value.author.name}` : `Post by @${post.value.author.name}`)
const description = computed(() => post.value.body?.description ?? post.value.body?.content.substring(0, 160).trim()) const description = computed(() => post.value.body?.description ?? post.value.body?.content.substring(0, 280).trim())
watch(attachments, (value) => { watch(attachments, (value) => {
if (post.value.body?.thumbnail) { if (post.value.body?.thumbnail) {
@ -124,7 +124,7 @@ watch(attachments, (value) => {
useHead({ useHead({
title: title.value, title: title.value,
titleTemplate: "%s on Solar Network", titleTemplate: "%s",
link: [ link: [
{ rel: "icon", type: "image/png", href: "/icon-solar-network.png" }, { rel: "icon", type: "image/png", href: "/icon-solar-network.png" },
{ rel: "apple-touch-icon", type: "image/png", href: "/icon-solar-network.png" }, { rel: "apple-touch-icon", type: "image/png", href: "/icon-solar-network.png" },