From d18af9f9f2d484265c1eff2e9cf7a82f15531baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=82=9F=E5=85=83?= <88357633+SunWuyuan@users.noreply.github.com> Date: Sun, 24 Nov 2024 14:57:27 +0800 Subject: [PATCH] Add vue-meta for page meta information Add meta information to various pages using `vue-meta`. * Import `createMetaManager` from `vue-meta` in `src/main.js` and create a meta manager instance. * Add meta information for title, description, and keywords to `src/pages/home.vue`. * Add meta information for title, description, and keywords to `src/pages/index.vue`. * Add meta information for title, description, and keywords to `src/pages/projects/index.vue`. * Add meta information for title, description, and keywords to `src/pages/projects/new.vue`. * Add meta information for title, description, and keywords to `src/pages/proxy/index.vue`. * Add meta information for title, description, and keywords to `src/pages/proxy/open.vue`. * Add meta information for title, description, and keywords to `src/pages/tools/asdm.vue`. * Add meta information for title, description, and keywords to `src/pages/account/login.vue`. * Add meta information for title, description, and keywords to `src/pages/account/register.vue`. * Add meta information for title, description, and keywords to `src/pages/algolia.vue`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ZeroCatDev/zerocat-frontend?shareId=XXXX-XXXX-XXXX-XXXX). --- src/main.js | 7 +++--- src/pages/account/login.vue | 10 ++++++++ src/pages/account/register.vue | 10 ++++++++ src/pages/algolia.vue | 11 ++++++++- src/pages/home.vue | 44 ++++++++-------------------------- src/pages/index.vue | 11 +++++++++ src/pages/projects/index.vue | 11 ++++++++- src/pages/projects/new.vue | 32 +++++++++++++++++-------- src/pages/proxy/index.vue | 10 ++++++++ src/pages/proxy/open.vue | 11 +++++++++ src/pages/tools/asdm.vue | 10 ++++++++ 11 files changed, 118 insertions(+), 49 deletions(-) diff --git a/src/main.js b/src/main.js index 2bca5d6..d336b9e 100644 --- a/src/main.js +++ b/src/main.js @@ -9,8 +9,8 @@ import { registerPlugins } from "@/plugins"; import ToastService from "primevue/toastservice"; import PrimeVue from "primevue/config"; import Aura from "@primevue/themes/aura"; - import InstantSearch from "vue-instantsearch/vue3/es"; +import { createMetaManager } from 'vue-meta'; // Pf95b // Components import App from "./App.vue"; @@ -25,9 +25,11 @@ app.use(PrimeVue, { }, }); app.use(ToastService); - app.use(InstantSearch); +const metaManager = createMetaManager(); // Pde41 +app.use(metaManager); // Pde41 + // 使用 Vercel Speed Insights 观测网站性能 import { injectSpeedInsights } from "@vercel/speed-insights"; injectSpeedInsights(); @@ -37,4 +39,3 @@ inject(); registerPlugins(app); app.mount("#app"); - diff --git a/src/pages/account/login.vue b/src/pages/account/login.vue index d32ee92..d4bdd52 100644 --- a/src/pages/account/login.vue +++ b/src/pages/account/login.vue @@ -128,9 +128,19 @@ import { getResponse, resetCaptcha, } from "../../stores/useRecaptcha"; +import { useMeta } from 'vue-meta'; export default { components: { LoadingDialog }, + setup() { + useMeta({ + title: 'ZeroCat - Login', + meta: [ + { name: 'description', content: 'Login to your ZeroCat account.' }, + { name: 'keywords', content: 'ZeroCat, login, account' } + ] + }); + }, data() { return { BASE_API: import.meta.env.VITE_APP_BASE_API, diff --git a/src/pages/account/register.vue b/src/pages/account/register.vue index 8b6b606..9639b8e 100644 --- a/src/pages/account/register.vue +++ b/src/pages/account/register.vue @@ -229,9 +229,19 @@ import { getResponse, resetCaptcha, } from "../../stores/useRecaptcha"; +import { useMeta } from 'vue-meta'; export default { components: { LoadingDialog }, + setup() { + useMeta({ + title: 'ZeroCat - Register', + meta: [ + { name: 'description', content: 'Create a new ZeroCat account.' }, + { name: 'keywords', content: 'ZeroCat, register, account' } + ] + }); + }, data() { return { BASE_API: import.meta.env.VITE_APP_BASE_API, diff --git a/src/pages/algolia.vue b/src/pages/algolia.vue index 2b574c5..9dc6779 100644 --- a/src/pages/algolia.vue +++ b/src/pages/algolia.vue @@ -113,9 +113,18 @@