게시물 SEO 설정 추가

This commit is contained in:
2026-05-03 10:03:53 +09:00
parent 60f9fd52f0
commit fc5f41b9cc
13 changed files with 174 additions and 6 deletions

View File

@@ -16,6 +16,44 @@ if (!post.value) {
}
const postTag = computed(() => post.value.tags?.[0]?.toUpperCase() || 'POST')
const config = useRuntimeConfig()
const siteUrl = computed(() => String(config.public.siteUrl || '').replace(/\/$/g, ''))
const pageUrl = computed(() => `${siteUrl.value}/post/${post.value.slug}`)
const seoTitle = computed(() => post.value.seoTitle || post.value.title)
const seoDescription = computed(() => post.value.seoDescription || post.value.excerpt || 'sori.studio 개인 블로그')
const canonicalUrl = computed(() => post.value.canonicalUrl || pageUrl.value)
useHead(() => ({
title: seoTitle.value,
link: [
{
rel: 'canonical',
href: canonicalUrl.value
}
],
meta: [
{
name: 'description',
content: seoDescription.value
},
{
name: 'robots',
content: post.value.noindex ? 'noindex, nofollow' : 'index, follow'
},
{
property: 'og:title',
content: seoTitle.value
},
{
property: 'og:description',
content: seoDescription.value
},
{
property: 'og:url',
content: pageUrl.value
}
]
}))
</script>
<template>