CloudProxyPro/nuxt.config.ts

72 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-09-05 14:59:21 +08:00
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
'@nuxtjs/tailwindcss',
'@nuxtjs/i18n',
'@nuxt/content',
'@nuxtjs/sitemap',
'@nuxtjs/robots'
],
// SSG配置
nitro: {
prerender: {
routes: ['/sitemap.xml']
}
},
// 国际化配置
i18n: {
locales: [
{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'zh', name: '简体中文', file: 'zh.json' },
{ code: 'zh-hant', name: '繁體中文', file: 'zh-hant.json' }
],
defaultLocale: 'en',
strategy: 'prefix_except_default',
lazy: true,
langDir: 'locales/',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root'
}
},
// 站点地图配置
sitemap: {
hostname: 'https://cloudproxy-pro.com',
gzip: true,
routes: async () => {
const { $content } = require('@nuxt/content')
const articles = await $content('').fetch()
return articles.map(article => `/blog/${article.slug}`)
}
},
// robots.txt配置
robots: {
UserAgent: '*',
Disallow: '/admin',
Sitemap: 'https://cloudproxy-pro.com/sitemap.xml'
},
// SEO配置
app: {
head: {
htmlAttrs: {
lang: 'en'
},
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
],
script: [
{
id: 'chatway',
async: true,
src: 'https://cdn.chatway.app/widget.js?id=FgIgGSxRD2i8'
}
]
}
}
})