OpenGraph

This commit is contained in:
2025-09-20 22:11:42 +08:00
parent b4c105b43e
commit dd6ff13228
16 changed files with 13280 additions and 26 deletions

View File

@@ -301,7 +301,36 @@ function getOffsetUTCString(targetTimeZone: string): string {
}
definePageMeta({
alias: ["/@[name]"]
alias: ["/@:name()"]
})
useHead({
title: computed(() => {
if (notFound.value) {
return "User not found"
}
if (user.value) {
return user.value.nick || user.value.name
}
return "Loading user..."
}),
meta: computed(() => {
if (user.value) {
const description = `View the profile of ${user.value.nick || user.value.name} on Solar Network.`
return [
{ name: 'description', content: description },
]
}
return []
})
})
defineOgImage({
component: 'WithAvatar',
title: computed(() => user.value ? user.value.nick || user.value.name : 'User Profile'),
description: computed(() => user.value ? `View the profile of ${user.value.nick || user.value.name} on Solar Network.` : ''),
avatarUrl: computed(() => userPicture.value),
backgroundImage: computed(() => userBackground.value),
})
</script>