diff --git a/app.vue b/app.vue index 31115ec9..2002e626 100644 --- a/app.vue +++ b/app.vue @@ -14,18 +14,24 @@ diff --git a/components/Products/ProductsSingleProduct.vue b/components/Products/ProductsSingleProduct.vue index bb1e13a6..88066d76 100644 --- a/components/Products/ProductsSingleProduct.vue +++ b/components/Products/ProductsSingleProduct.vue @@ -105,6 +105,24 @@ const props = defineProps({ const variables = { id: props.id, slug: props.slug }; const { data } = await useAsyncQuery(GET_SINGLE_PRODUCT_QUERY, variables); +watch( + () => data.value, + (productData) => { + if (productData?.product) { + const { name, description, image } = productData.product; + useSeoMeta({ + title: name, + description: stripHTML(description), + ogTitle: name, + ogDescription: stripHTML(description), + ogImage: image?.sourceUrl, + twitterCard: 'summary_large_image', + }); + } + }, + { immediate: true }, +); + watch( () => data.value, (dataValue) => { diff --git a/nuxt.config.js b/nuxt.config.js index c72c6e52..e85c337a 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -30,11 +30,6 @@ export default defineNuxtConfig({ }, }, app: { - head: { - charset: "utf-8", - viewport: "width=500, initial-scale=1", - meta: [{ name: "description", content: "Nuxt 3 - Woocommerce" }], - }, // global transition pageTransition: { name: "page", mode: "out-in" }, layoutTransition: { name: "layout", mode: "out-in" }, diff --git a/pages/product/[product].vue b/pages/product/[product].vue index 193fe76d..b2ab8e3a 100644 --- a/pages/product/[product].vue +++ b/pages/product/[product].vue @@ -4,18 +4,4 @@