From b05faddfc08b0154ba36c10391fa2ac21e6ab0d6 Mon Sep 17 00:00:00 2001 From: xiaomai Date: Sat, 4 Oct 2025 11:03:21 +0800 Subject: [PATCH] feat(seo): implement dynamic page titles This commit enhances SEO and user experience by setting dynamic page titles for detail pages and updating the global title configuration. - Event, Hall of Fame, and News detail pages now use the specific item's title as the page title. - The global `titleTemplate` and default `title` in `nuxt.config.ts` have been updated for better branding. - These changes ensure each page has a unique, descriptive title, which is beneficial for search engine ranking and browser tab clarity. --- .gitignore | 2 ++ app/pages/events/[slug].vue | 4 ++++ app/pages/hall-of-fames/[slug].vue | 7 ++++++- app/pages/news/[slug].vue | 4 ++++ nuxt.config.ts | 4 ++-- public/Logo.svg | 15 ++------------- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 4a7f73a..99b3c47 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ logs .env .env.* !.env.example + +repomix-output.xml \ No newline at end of file diff --git a/app/pages/events/[slug].vue b/app/pages/events/[slug].vue index 0472026..5b12802 100644 --- a/app/pages/events/[slug].vue +++ b/app/pages/events/[slug].vue @@ -56,6 +56,10 @@ const { data: event } = await useAsyncData('event-detail', () => .path(`/events/${route.params.slug}`) .first() ) + +useHead({ + title: event.value?.title +}) diff --git a/app/pages/hall-of-fames/[slug].vue b/app/pages/hall-of-fames/[slug].vue index 9e20ee2..5e3ed35 100644 --- a/app/pages/hall-of-fames/[slug].vue +++ b/app/pages/hall-of-fames/[slug].vue @@ -24,7 +24,8 @@ class="w-full h-48 object-cover transition-transform duration-500 group-hover:scale-110" />
- +
@@ -40,6 +41,10 @@ const { data: person } = await useAsyncData('hall-of-fames-detail', () => .path(`/hall-of-fames/${route.params.slug}`) .first() ) + +useHead({ + title: person.value?.name +}) \ No newline at end of file diff --git a/app/pages/news/[slug].vue b/app/pages/news/[slug].vue index d477493..6799bde 100644 --- a/app/pages/news/[slug].vue +++ b/app/pages/news/[slug].vue @@ -24,6 +24,10 @@ const { data: n } = await useAsyncData('new-detail', () => .path(`/news/${route.params.slug}`) .first() ) + +useHead({ + title: n.value?.title +}) \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index 8c26776..299667e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -19,8 +19,8 @@ export default defineNuxtConfig({ }, app: { head: { - titleTemplate: "%s - 永平中学校友会", - title: "永平中学校友会", + titleTemplate: "%s | 永中校友会", + title: "永中校友圈", script: [ { src: "/analytics.js", diff --git a/public/Logo.svg b/public/Logo.svg index dac7d9c..b0bceb8 100644 --- a/public/Logo.svg +++ b/public/Logo.svg @@ -1,7 +1,8 @@ + viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve" + width="200" height="200"> - - - - - - - - - - - -