mirror of
https://github.com/Kisechan/Mainpage.git
synced 2025-07-10 15:17:18 +00:00
添加 @unhead/vue 和 vite-plugin-sitemap 依赖,更新路由元信息以包含描述标签,配置 sitemap 插件,添加 robots.txt 文件
This commit is contained in:
15
src/App.vue
15
src/App.vue
@ -1,9 +1,22 @@
|
||||
<script setup>
|
||||
import NavBar from "./components/NavBar.vue";
|
||||
import AppFooter from "./components/AppFooter.vue";
|
||||
import { useRouter } from 'vue-router'
|
||||
import { watch } from 'vue'
|
||||
import { useHead } from '@unhead/vue'
|
||||
|
||||
const openGitHubRepo = () => {
|
||||
window.open("https://github.com/Kisechan/Mainpage", "_self");
|
||||
};
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
watch(() => router.currentRoute.value, (route) => {
|
||||
useHead({
|
||||
title: route.meta.title,
|
||||
meta: route.meta.metaTags || [],
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -60,4 +73,4 @@ body {
|
||||
.github-corner:hover {
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -8,14 +8,17 @@ import './assets/styles/global.css'
|
||||
import '@fortawesome/fontawesome-free/css/all.css';
|
||||
import 'github-calendar/dist/github-calendar-responsive.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import { createHead } from '@unhead/vue'
|
||||
|
||||
const app = createApp(App)
|
||||
const head = createHead()
|
||||
|
||||
// 注册所有图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
app.use(head)
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
app.mount('#app')
|
@ -5,19 +5,44 @@ const routes = [
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: () => import("@/views/HomeView.vue"),
|
||||
meta: { hideFooter: true, title: "主页" },
|
||||
meta: {
|
||||
hideFooter: true,
|
||||
title: "主页",
|
||||
metaTags: [
|
||||
{
|
||||
name: "description",
|
||||
content: "Kisechan的个人主页。",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/links",
|
||||
name: "links",
|
||||
component: () => import("@/views/LinksView.vue"),
|
||||
meta: { title: "友链" },
|
||||
meta: {
|
||||
title: "友链",
|
||||
metaTags: [
|
||||
{
|
||||
name: "description",
|
||||
content: "Kisechan的个人主页 - 友链部分。",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/tools",
|
||||
name: "tools",
|
||||
component: () => import("@/views/ToolsView.vue"),
|
||||
meta: { title: "工具" },
|
||||
meta: {
|
||||
title: "工具",
|
||||
metaTags: [
|
||||
{
|
||||
name: "description",
|
||||
content: "Kisechan的个人主页 - 工具部分。",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
|
Reference in New Issue
Block a user