Skip to content

Commit

Permalink
feat: 优化 SEO 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwumm committed Jun 24, 2024
1 parent 2301593 commit 1fbdf5a
Show file tree
Hide file tree
Showing 10 changed files with 10,107 additions and 6,067 deletions.
32 changes: 17 additions & 15 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ export default defineNuxtConfig({
baseUrl: 'https://dream-site.cn'
}
},
// SEO 和 Meta
app: {
head: {
title: '程序员的梦中情站',
charset: 'utf-8',
viewport: 'width=device-width, initial-scale=1',
meta: [
{ name: 'keywords', content: 'Nuxt.js,导航,网站' },
{ name: 'description', content: '致力于打造程序员的梦中情站' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
]
},
pageTransition: { name: 'blur', mode: 'out-in' }, // 页面过渡效果
},
// 源目录
Expand All @@ -33,7 +20,8 @@ export default defineNuxtConfig({
'@nuxtjs/color-mode',
'nuxt-icon',
'nuxt-clarity-analytics',
"nuxt-gtag"
"nuxt-gtag",
"@nuxtjs/seo"
],
supabase: {
redirectOptions: {
Expand All @@ -49,5 +37,19 @@ export default defineNuxtConfig({
viewTransition: true
},
css: ['element-plus/theme-chalk/dark/css-vars.css', '~/assets/scss/main.scss'],
extends: ['nuxt-umami']
extends: ['nuxt-umami'],
// SEO 配置
site: {
url: 'https://dream-site.cn',
name: 'Dream Site',
description: '致力于打造程序员的梦中情站',
defaultLocale: 'zh-cn',
exclude: ['/admin/_components/**'], // 过滤不需要的 url
cacheMaxAgeSeconds: 24 * 3600, // 缓存时间一天
autoLastmod: true, // 自动检测每个 URL 的 lastmod 日期
},
routeRules: {
// Don't add any /secret/** URLs to the sitemap.xml
'/admin/_components/**': { robots: false },
}
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"release": "release-it"
},
"dependencies": {
"@nuxtjs/seo": "2.0.0-rc.11",
"@supabase/supabase-js": "^2.43.4",
"@vue/shared": "^3.4.27",
"element-plus": "^2.7.5",
Expand Down
Loading

0 comments on commit 1fbdf5a

Please sign in to comment.