From 9e447e4c9aa6bf41de14e9a7bf8822e5145f96dd Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Thu, 13 Mar 2025 12:29:27 +0300 Subject: [PATCH] seo --- error.vue | 2 +- index.d.ts | 2 +- pages/index.vue | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/error.vue b/error.vue index 87af609..988d557 100644 --- a/error.vue +++ b/error.vue @@ -6,7 +6,7 @@ const { fetchData } = useApiFetch() import type { NuxtError } from '#app' import og_img from '/og_img.png' -const { data: seoData } = await fetchData(`kp/2/`) +const { data: seoData } = await fetchData(`kp/2/`) useSeoMeta({ title: seoData.value?.title, diff --git a/index.d.ts b/index.d.ts index 9b1470a..ef1bcf3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,7 +3,7 @@ declare module '*.glb' { export default src } -type ApiKpType = { +type Seo = { id: number title: string content: string diff --git a/pages/index.vue b/pages/index.vue index 9f60737..c1b1f6f 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -7,16 +7,16 @@ import { marked } from 'marked'; import og_img from '/og_img.png' -// const { data: seoData } = await apiFetch(`kp/1/`) -// useSeoMeta({ -// title: seoData.value?.title, -// ogTitle: seoData.value?.title, -// description: seoData.value?.content, -// ogDescription: seoData.value?.content, -// ogImage: config.public.baseUrl + og_img, -// // twitterCard: 'summary_large_image', -// }) -const { data, status, error } = await fetchData(`menu/`) +const { data: seo } = await fetchData(`seo/`) +useSeoMeta({ + title: seo.value && seo.value[0].title, + ogTitle: seo.value && seo.value[0].title, + description: seo.value && seo.value[0].content, + ogDescription: seo.value && seo.value[0].content, + ogImage: config.public.baseUrl + og_img, +}) + +const { data } = await fetchData(`menu/`) const pages = computed(() => { const menu = data.value?.find(el => el.type == 1) return (menu?.pages || []).sort((a, b) => a.order - b.order)