nuxt composion-api로 동적 페이지의 OGP 설정
4148 단어 Nuxt.jsnuxtogpcompostionapitech
option API로 하는 방법은 검색이 많지만 nuxt-composion-api로 하는 방법이 없어서 기재했습니다.
설치 방법
<script lang="ts">
import {
defineComponent,
reactive,
toRefs,
useAsync,
useMeta,
} from '@nuxtjs/composition-api'
export default defineComponent({
// useMetaを利用する場合、headを定義しておかないと怒られる
head: {},
setup() {
const { meta } = useMeta()
meta.value = [
{
hid: 'og:description',
property: 'og:description',
content: 'OGPの説明',
},
{
hid: 'og:url',
property: 'og:url',
content: 'OGPのURL',
},
{
hid: 'og:image',
property: 'og:image',
content: 'OGPの画像',
},
]
}
</script>
Reference
이 문제에 관하여(nuxt composion-api로 동적 페이지의 OGP 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/tai_hatake/articles/b316744895a993텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)