get seo data

This commit is contained in:
Kseninia Mikhaylova 2024-06-03 17:09:06 +03:00
parent 1497281945
commit 6192f87a4d
2 changed files with 29 additions and 1 deletions

27
app.vue
View File

@ -1,5 +1,30 @@
<script setup lang="ts">
const config = useRuntimeConfig()
const apiBase = config.public.apiBase
type ApiKpType = {
id: number
title: string
content: string
url: string
meta_title: any
meta_description: string
keywords: any
is_indexed: boolean
}
const { data: seoData } = await useFetch<ApiKpType>(`${apiBase}/kp/1`)
useSeoMeta({
title: seoData.value?.title,
ogTitle: seoData.value?.title,
description: seoData.value?.content,
ogDescription: seoData.value?.content,
// ogImage: 'https://example.com/image.png',
// twitterCard: 'summary_large_image',
})
</script>
<template> <template>
<div> <div>
<NuxtWelcome /> <NuxtPage />
</div> </div>
</template> </template>

3
pages/index.vue Normal file
View File

@ -0,0 +1,3 @@
<template>
this is index page
</template>