buddyscloud/nuxt.config.js

103 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

import path from "path"; // ✅ 先引入 path 模块
2025-03-11 13:58:21 +08:00
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'buddysCloud',
2025-04-16 19:09:05 +08:00
script: [
{
2025-04-24 14:27:30 +08:00
src: 'https://www.googletagmanager.com/gtag/js?id=G-KNJFL438C1',
2025-04-16 19:09:05 +08:00
async: true,
},
{
innerHTML: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
2025-04-24 14:27:30 +08:00
gtag('config', 'G-KNJFL438C1');
2025-04-16 19:09:05 +08:00
`,
type: 'text/javascript',
},
2025-04-17 10:44:30 +08:00
{
innerHTML: `(function(d,w,c){if(w[c])return;var s=d.createElement("script");w[c]=function(){(w[c].z=w[c].z||[]).push(arguments);};s.async=true;s.src="https://static.ahc.ink/hecong.js";if(d.head)d.head.appendChild(s);})(document,window,"_AIHECONG");_AIHECONG("ini",{channelId:"9BgJ9p"});`,
type: 'text/javascript',
body: true
},
],
link: [
{ rel: "icon", type: "image/x-icon", href: "favicon.ico" }
2025-04-16 19:09:05 +08:00
],
__dangerouslyDisableSanitizers: ['script'], // 允许内联脚本
2025-03-11 13:58:21 +08:00
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
],
2025-03-11 13:58:21 +08:00
},
serverMiddleware: [
{ path: "/api/news", handler: path.resolve(__dirname, "server/readNews.js") }
],
2025-03-11 13:58:21 +08:00
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
content: {
// ✅ 配置 Markdown 目录
dir: "static/news",
},
2025-03-11 13:58:21 +08:00
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/bootstrap
'bootstrap-vue/nuxt',
'@nuxt/content',
'@nuxtjs/axios',
2025-04-16 19:09:05 +08:00
// '@nuxtjs/google-analytics'
'@nuxtjs/gtm'
2025-03-11 13:58:21 +08:00
],
2025-04-16 19:09:05 +08:00
// buildModules:[
// '@nuxtjs/google-analytics'
// ],
2025-04-15 20:14:33 +08:00
gtm: {
2025-04-24 14:27:30 +08:00
id: 'GTM-5M5JNS4K',
2025-04-15 20:14:33 +08:00
layer: 'dataLayer',
2025-04-16 19:09:05 +08:00
pageTracking: false, // ✅ 关闭 GTM 的自动页面跟踪,避免和 GA 冲突
2025-04-15 20:14:33 +08:00
enabled: true
// enabled: process.env.NODE_ENV === 'production'
},
2025-04-16 19:09:05 +08:00
// googleAnalytics: {
// id: 'G-PMXV6BN06E',
// debug: true,
// autoTracking: {
// screenview: true, // GA 自己管理页面跟踪
// },
// },
2025-03-11 13:58:21 +08:00
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
2025-04-24 14:27:30 +08:00
},
render: {
csp: {
policies: {
'script-src': ["'self'", "'unsafe-eval'"],
// 其他策略...
}
}
2025-03-11 13:58:21 +08:00
}
}