From 0a57968dcbed8272059f9414587db352729c77d9 Mon Sep 17 00:00:00 2001 From: tan Date: Sun, 10 Nov 2024 19:16:36 +0800 Subject: [PATCH] Fix meta default --- app.vue | 9 ++++++--- composables/useSeo.ts | 17 ++++++++++++----- layouts/base.vue | 2 +- pages/about/index.vue | 2 +- server/tsconfig.json | 3 --- 5 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 server/tsconfig.json diff --git a/app.vue b/app.vue index 6ad20c8..7aa6591 100644 --- a/app.vue +++ b/app.vue @@ -6,10 +6,13 @@ const route = useRoute() function initSeoMeta() { useSeo({ title: route.meta.title as string, - ogTitle: route.meta.ogTitle as string, + ogTitle: route.meta.title as string, description: route.meta.description as string, - ogDescription: route.meta.ogDescription as string, - ogImage: route.meta.ogImage as string, + ogDescription: route.meta.description as string, + ogImageUrl: route.meta.image as string, + twitterTitle: route.meta.title as string, + twitterDescription: route.meta.description as string, + twitterImage: route.meta.image as string, }) } diff --git a/composables/useSeo.ts b/composables/useSeo.ts index eb3f136..4bf5737 100644 --- a/composables/useSeo.ts +++ b/composables/useSeo.ts @@ -1,19 +1,26 @@ import { useSeoMeta } from '#imports' +// NB: It's important to change the default value of every metadata here. export function useSeo({ title = 'Default Title', - ogTitle = 'Default OG Title', description = 'This is the default description, let me tell you all about it.', - ogDescription = 'This is my amazing site, let me tell you all about it.', - ogImage = 'https://example.com/image.png', + ogTitle = 'Default Title', + ogDescription = 'This is the default description, let me tell you all about it.', + ogImageUrl = 'https://example.com/image.png', + twitterTitle = 'Default Title', + twitterDescription = 'This is the default description, let me tell you all about it.', + twitterImage = 'https://example.com/image.png', } = {}) { useSeoMeta({ title, - ogTitle, description, + ogTitle, ogDescription, - ogImage, + ogImageUrl, + twitterTitle, twitterCard: 'summary_large_image', + twitterDescription, + twitterImage, mobileWebAppCapable: 'yes', }) } diff --git a/layouts/base.vue b/layouts/base.vue index 9c7267c..6bc62c5 100644 --- a/layouts/base.vue +++ b/layouts/base.vue @@ -1,5 +1,5 @@