Files
Zncfont_V2/server/generate-seo-templates.cjs
2026-02-28 16:47:46 +08:00

243 lines
11 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* SEO模板生成器
* 根据路由配置自动生成静态HTML模板
*/
const fs = require('fs')
const path = require('path')
// 页面SEO配置与useSEO.js保持一致
const pageSEOConfigs = {
'index.html': {
title: '智能查|大数据风险报告查询与代理平台,支持个人和企业多场景风控应用',
description: '智能查,专业大数据风险报告查询与代理平台,支持个人信用查询、小微企业风控、贷前风险背调等多场景报告应用,免费开通代理权限,助力高效识别信用与风险。',
keywords: '大数据风险报告查询、大数据风险评估、大数据分析报告、个人大数据风险查询、小微企业风险、贷前风险背调、代理管理平台、免费开通代理、风险管控平台、信用风险分析、企业风险报告、贷前信用审核、失信人名单查询、被执行人信息、信用黑名单查询',
url: 'https://www.zhinengcha.cn'
},
'agent.html': {
title: '智能查代理 - 免费开通代理权限 | 大数据风险报告代理',
description: '智能查代理平台,免费开通代理权限,享受大数据风险报告查询服务代理收益。专业的大数据风险报告、婚姻查询、个人信用评估等服务的代理合作。',
keywords: '智能查代理, 免费代理, 大数据风险报告代理, 代理权限, 代理收益',
url: 'https://www.zhinengcha.cn/agent'
},
'help.html': {
title: '帮助中心 - 智能查使用指南 | 常见问题解答',
description: '智能查帮助中心,提供详细的使用指南、常见问题解答、操作教程等,帮助用户更好地使用大数据风险报告查询服务。',
keywords: '智能查帮助, 使用指南, 常见问题, 操作教程, 客服支持',
url: 'https://www.zhinengcha.cn/help'
},
'help-guide.html': {
title: '使用指南 - 智能查操作教程 | 功能说明',
description: '智能查详细使用指南,包含各功能模块的操作教程、功能说明、注意事项等,让用户快速上手使用。',
keywords: '使用指南, 操作教程, 功能说明, 快速上手, 智能查教程',
url: 'https://www.zhinengcha.cn/help/guide'
},
'example.html': {
title: '示例报告 - 智能查报告展示 | 大数据风险报告样例',
description: '智能查示例报告展示,包含大数据风险报告、婚姻状况查询、个人信用评估等服务的报告样例,让用户了解报告内容和格式。',
keywords: '示例报告, 报告展示, 报告样例, 大数据风险报告, 婚姻查询报告',
url: 'https://www.zhinengcha.cn/example'
},
'service.html': {
title: '客服中心 - 智能查在线客服 | 技术支持',
description: '智能查客服中心,提供在线客服支持、技术咨询、问题反馈等服务,确保用户获得及时有效的帮助。',
keywords: '客服中心, 在线客服, 技术支持, 问题反馈, 智能查客服',
url: 'https://www.zhinengcha.cn/service'
},
'inquire-riskassessment.html': {
title: '个人综合履约能力画像_多维风险指数检测_信用健康度_智能查',
description: '深度解析个人履约能力综合状况,辅助用户进行风险自查。报告维度包含历史履约趋势、多维生活经营风险指数及关联负面标签。数据客观中立,实时更新,帮助用户优化个人资信档案,提升生活经营能力。',
keywords: '个人风险画像,履约能力评估,综合风险指数,信用健康体检,个人数据分析',
url: 'https://www.zhinengcha.cn/inquire/riskassessment'
},
'inquire-companyinfo.html': {
title: '商业背景真实性核验_企业主经营实力与司法风险_智能查',
description: '智能查企业版助您鉴别商业背景的真实性。一键核验目标对象的名下关联企业、工商变更记录、司法被执行信息及股权冻结状况。全方位评估经营实力与法律风险,规避商业合作或家庭资产联保隐患。',
keywords: '商业背景核验,企业主信用评估,公司经营风险,工商信息核验,资产风险评估',
url: 'https://www.zhinengcha.cn/inquire/companyinfo'
},
'inquire-marriage.html': {
title: '婚前综合背景了解_涉婚司法风险评估_情感诚意度报告_智能查',
description: '智能查婚恋报告基于公开司法大数据,提供客观的婚前背景参考。深度评估对象的涉婚法律诉讼、失信被执行历史及社会不良标签。旨在消除信息不对称,辅助用户建立透明、安全的婚姻基础。',
keywords: '婚前背景核验,恋爱对象风险,婚姻司法记录,情感互信报告,家庭履约风险',
url: 'https://www.zhinengcha.cn/inquire/marriage'
},
'promote.html': {
title: '智能查合作伙伴计划_婚恋行业数字化风控解决方案_渠道招募',
description: '智能查开放全国渠道合作,为婚介机构及情感咨询师提供专业的数据化风控工具。一键接入婚恋风险评估系统,支持推广海报生成与多级数据管理。正规项目,赋能合作伙伴,共同挖掘婚恋市场的合规商业价值。',
keywords: '婚恋行业合作,情感咨询工具,风控系统代理,渠道合作伙伴,婚介数据服务',
url: 'https://www.zhinengcha.cn/promote'
}
}
/**
* 规范化文案移除损坏字符U+FFFD统一为中文标点避免乱码
*/
function normalizeText(str) {
if (typeof str !== 'string') return str
return str
.replace(/\uFFFD/g, '') // 移除 UTF-8 替换符(乱码)
.replace(/。/g, '。')
.replace(/、/g, '、')
}
/**
* 生成HTML模板
*/
function generateHTMLTemplate(config) {
const title = normalizeText(config.title)
const description = normalizeText(config.description)
const keywords = normalizeText(config.keywords)
const structuredData = {
"@context": "https://schema.org",
"@type": "WebPage",
"name": title,
"description": description,
"url": config.url,
"mainEntity": {
"@type": "Organization",
"name": "智能查",
"url": "https://www.zhinengcha.cn/",
"description": "专业大数据风险报告查询与代理平台,支持个人和企业多场景风控应用"
}
}
return `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 页面标题 -->
<title>${title}</title>
<!-- SEO Meta标签 -->
<meta name="description" content="${description}">
<meta name="keywords" content="${keywords}">
<!-- Open Graph标签 -->
<meta property="og:title" content="${title}">
<meta property="og:description" content="${description}">
<meta property="og:url" content="${config.url}">
<meta property="og:type" content="website">
<meta property="og:site_name" content="智能查">
<meta property="og:locale" content="zh_CN">
<!-- Twitter Cards -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="${title}">
<meta name="twitter:description" content="${description}">
<meta name="twitter:url" content="${config.url}">
<!-- Canonical URL -->
<link rel="canonical" href="${config.url}">
<!-- 结构化数据 -->
<script type="application/ld+json">
${JSON.stringify(structuredData, null, 8)}
</script>
<!-- 其他Meta标签 -->
<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow">
<meta name="baiduspider" content="index, follow">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
margin: 0;
padding: 0;
line-height: 1.6;
}
.seo-content {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
h1 { color: #333; }
p { color: #666; }
.redirect-notice {
background: #fff3cd;
border: 1px solid #ffc107;
color: #856404;
padding: 10px;
margin: 20px 0;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="seo-content">
<h1>${title}</h1>
<div class="redirect-notice">
<p>正在跳转到完整版网站...</p>
<p>如果浏览器没有自动跳转,请 <a href="${config.url}">点击这里</a></p>
</div>
<p>${description}</p>
<!-- 这里可以添加更多SEO友好的静态内容 -->
<section>
<h2>关于智能查</h2>
<p>智能查是专业的大数据风险报告查询与代理平台,提供全方位的风险查询服务。我们的核心使命是帮助用户高效识别信用与风险。</p>
</section>
<section>
<h2>核心服务</h2>
<ul>
<li>个人综合履约能力画像</li>
<li>商业背景真实性核验</li>
<li>婚前综合背景了解</li>
<li>涉婚司法风险评估</li>
<li>情感诚意度报告</li>
</ul>
</section>
<section>
<h2>为什么选择智能查</h2>
<p>智能查依托大数据技术,为用户提供准确、及时的婚恋风险评估报告,帮助您做出明智决策。</p>
</section>
</div>
<script>
// 可选自动跳转到SPA应用
// setTimeout(function() {
// window.location.href = '${config.url}';
// }, 2000);
</script>
</body>
</html>`
}
/**
* 主函数
*/
function main() {
const outputDir = path.join(__dirname, '../dist/seo-templates')
// 创建输出目录
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true })
console.log(`✓ 创建模板目录: ${outputDir}`)
}
// 生成所有模板文件
let successCount = 0
Object.entries(pageSEOConfigs).forEach(([filename, config]) => {
const htmlContent = generateHTMLTemplate(config)
const filePath = path.join(outputDir, filename)
fs.writeFileSync(filePath, htmlContent, 'utf-8')
console.log(`✓ 生成模板: ${filename}`)
successCount++
})
console.log(`\n✓ 成功生成 ${successCount} 个SEO模板文件`)
console.log(`📁 模板目录: ${outputDir}`)
}
// 执行生成
main()