Files
qnc-webview-v3/server/generate-seo-templates.cjs

246 lines
13 KiB
JavaScript
Raw Normal View History

2026-02-28 14:33:47 +08:00
/**
* SEO模板生成器
* 根据 useSEO.js 的页面配置自动生成静态 HTML 模板供爬虫访问时返回
* 配置与 src/composables/useSEO.js 保持一致
*
* 多站点通过环境变量 SEO_BASE_URL 指定 canonical/og:url 域名后生成
* SEO_BASE_URL=https://www.quannengcha.com node generate-seo-templates.cjs
*/
const fs = require('fs')
const path = require('path')
const BASE_URL = process.env.SEO_BASE_URL || 'https://www.quannengcha.com'
// 页面 SEO 配置(与 src/composables/useSEO.js 的 routeConfigs 保持一致)
const pageSEOConfigs = {
'index.html': {
title: '全能查官网_个人婚姻状态报告_综合风险排查工具箱',
description: '全能查是您的掌上风控工具箱。平台基于合规数据,提供个人婚姻状态分析、职场背调及黑名单筛查服务。无需繁琐流程,客观中立,一键生成包含婚姻涉诉历史与家庭风险的综合报告,助您快速识别潜在隐患。',
keywords: '全能查,婚姻状态核实,风险排查工具,个人风险预警,第三方背调,商业信用评估',
url: BASE_URL
},
'agent-system-guide.html': {
title: '全能查合作政策指南_合作伙伴权益与结算说明_官方文档',
description: '全能查官方合作体系说明文档。详细解读合作伙伴的等级权益、服务费结算标准及晋升机制。致力于构建公平、透明的商业合作生态,助力合作伙伴快速上手业务。',
keywords: '合作伙伴政策,服务费结算,渠道等级说明,业务操作指南,代理系统后台',
url: `${BASE_URL}/agent/system-guide`
},
'inquire-riskassessment.html': {
title: '个人综合风险分析_履约能力画像_多维数据检测_全能查',
description: '全能查个人风险报告为您提供全方位的信用健康度参考。基于公开数据深度解析综合风险指数、司法关联风险、历史履约趋势及潜在的负面标签。数据客观中立,帮助用户建立良好的个人履约记录管理意识。',
keywords: '个人风险检测,履约能力分析,综合风险指数,信用健康度,个人数据画像',
url: `${BASE_URL}/inquire/riskassessment`
},
'inquire-companyinfo.html': {
title: '企业工商信用画像_经营异常与商业风险透视_全能查',
description: '全能查企业版深度透视商业真相。聚合工商、司法及税务公开数据,核验企业经营异常名录、行政处罚、法律诉讼及股权穿透信息。全方位评估合作伙伴的商业健康度,规避合同违约风险。',
keywords: '企业信用评估,工商背景核验,商业风险评估,公司经营异常,合作方背景核实',
url: `${BASE_URL}/inquire/companyinfo`
},
'inquire-preloanbackgroundcheck.html': {
title: '综合履约评分检测_多平台履约记录分析_个人财务履约报告_全能查',
description: '全能查提供专业的个人履约健康度体检服务。基于多维大数据分析,检测您的综合评分波动、历史履约记录及潜在的风险标签。本服务旨在帮助用户优化个人数据画像,提升信用管理意识,不提供任何信贷金融服务。',
keywords: '综合评分检测,多重履约压力分析,履约能力评估,综合评分优化,个人数据画像',
url: `${BASE_URL}/inquire/preloanbackgroundcheck`
},
'inquire-marriage.html': {
title: '婚前综合背景了解_情感安全风险评估_家庭履约分析_全能查',
description: '全能查婚恋风险报告基于合法公开数据,辅助评估对象的婚前背景。核心核验司法涉诉记录、失信被执行历史、多重履约能力及不良社会标签。拒绝情感盲区,用数据守护您的家庭与财产安全。',
keywords: '婚前背景报告,恋爱对象风险,情感安全评估,司法记录核验,家庭风险防范',
url: `${BASE_URL}/inquire/marriage`
},
'inquire-backgroundcheck.html': {
title: '职场背景核验报告_候选人职业风险与竞业核验_全能查',
description: '全能查为企业提供专业的入职背调服务。一键筛查候选人的学历背景、涉及的商业利益冲突、劳动仲裁记录及社会不良风险。数据实时合规,降低企业用工试错成本,提升招聘决策效率。',
keywords: '员工入职背调,职业背景核实,竞业限制评估,职场信用报告,候选人风险筛查',
url: `${BASE_URL}/inquire/backgroundcheck`
},
'inquire-homeservice.html': {
title: '家政人员背景核实_保姆月嫂司法安全评估_全能查',
description: '全能查针对家庭用工场景,提供客观的家政人员背景核验服务。重点核验身份信息、司法涉诉记录及失信历史。辅助雇主识别高危人员,让居家养老育儿更安心。',
keywords: '保姆背景核验,家政风险筛查,月嫂司法记录,雇佣安全评估,家政人员核验',
url: `${BASE_URL}/inquire/homeservice`
},
'inquire-consumerFinanceReport.html': {
title: '个人履约能力评估_经济风险与收支压力参考_全能查',
description: '全能查履约报告基于大数据算法,提供个人经济稳定性的客观分析。多维度检测综合履约分、经济关联风险及潜在的资金压力指数。本服务仅提供大数据层面的风险参考,助您优化财务管理。',
keywords: '履约能力评估,经济风险指数,综合评分波动,资金压力分析,财务健康度',
url: `${BASE_URL}/inquire/consumerFinanceReport`
},
'agent.html': {
title: '全能查代理 - 免费开通代理权限 | 大数据风险报告代理',
description: '全能查代理平台,免费开通代理权限,享受大数据风险报告查询服务代理收益。专业的大数据风险报告、婚姻查询、个人信用评估等服务的代理合作。',
keywords: '全能查代理, 免费代理, 大数据风险报告代理, 代理权限, 代理收益',
url: `${BASE_URL}/agent`
},
'help.html': {
title: '帮助中心 - 全能查使用指南 | 常见问题解答',
description: '全能查帮助中心,提供详细的使用指南、常见问题解答、操作教程等,帮助用户更好地使用大数据风险报告查询服务。',
keywords: '全能查帮助, 使用指南, 常见问题, 操作教程, 客服支持',
url: `${BASE_URL}/help`
},
'help-guide.html': {
title: '使用指南 - 全能查操作教程 | 功能说明',
description: '全能查详细使用指南,包含各功能模块的操作教程、功能说明、注意事项等,让用户快速上手使用。',
keywords: '使用指南, 操作教程, 功能说明, 快速上手, 全能查教程',
url: `${BASE_URL}/help/guide`
},
'example.html': {
title: '示例报告 - 全能查报告展示 | 大数据风险报告样例',
description: '全能查示例报告展示,包含大数据风险报告、婚姻状况查询、个人信用评估等服务的报告样例,让用户了解报告内容和格式。',
keywords: '示例报告, 报告展示, 报告样例, 大数据风险报告, 婚姻查询报告',
url: `${BASE_URL}/example`
},
'service.html': {
title: '客服中心 - 全能查在线客服 | 技术支持',
description: '全能查客服中心,提供在线客服支持、技术咨询、问题反馈等服务,确保用户获得及时有效的帮助。',
keywords: '客服中心, 在线客服, 技术支持, 问题反馈, 全能查客服',
url: `${BASE_URL}/service`
},
'promote.html': {
title: '全能查合伙人计划_风控平台系统招商_渠道合作平台_全能查',
description: '全能查开放全国渠道合作,提供零门槛的风险评估系统接入服务。一键开通独立后台,支持婚恋、职场、家政及商业风控等多场景报告推广。正规项目,结算透明,赋能流量方实现合规商业价值。',
keywords: '风控系统代理,风险评估平台招商,平台渠道合作,企业服务创业,全能查合伙人',
url: `${BASE_URL}/promote`
}
}
/**
* 规范化文案统一为中文标点避免乱码
*/
function normalizeText(str) {
if (typeof str !== 'string') return str
return str
.replace(/\uFFFD/g, '')
.replace(/。/g, '。')
.replace(/、/g, '、')
}
/**
* 转义 HTML 属性值
*/
function escapeAttr(str) {
if (typeof str !== 'string') return ''
return str
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
}
/**
* 生成单页 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.quannengcha.com/',
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>${escapeAttr(title)}</title>
<meta name="description" content="${escapeAttr(description)}">
<meta name="keywords" content="${escapeAttr(keywords)}">
<meta property="og:title" content="${escapeAttr(title)}">
<meta property="og:description" content="${escapeAttr(description)}">
<meta property="og:url" content="${escapeAttr(config.url)}">
<meta property="og:type" content="website">
<meta property="og:site_name" content="全能查">
<meta property="og:locale" content="zh_CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="${escapeAttr(title)}">
<meta name="twitter:description" content="${escapeAttr(description)}">
<meta name="twitter:url" content="${escapeAttr(config.url)}">
<link rel="canonical" href="${escapeAttr(config.url)}">
<script type="application/ld+json">
${JSON.stringify(structuredData, null, 8)}
</script>
<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>${escapeAttr(title)}</h1>
<div class="redirect-notice">
<p>正在跳转到完整版网站...</p>
<p>如果浏览器没有自动跳转 <a href="${escapeAttr(config.url)}">点击这里</a></p>
</div>
<p>${escapeAttr(description)}</p>
<section>
<h2>关于全能查</h2>
<p>全能查是您的掌上风控工具箱平台基于合规数据提供个人婚姻状态分析职场背调及黑名单筛查服务无需繁琐流程客观中立一键生成包含婚姻涉诉历史与家庭风险的综合报告助您快速识别潜在隐患</p>
</section>
<section>
<h2>核心服务</h2>
<ul>
<li>个人综合风险分析与履约能力画像</li>
<li>企业工商信用画像与商业风险透视</li>
<li>婚前综合背景了解与情感安全风险评估</li>
<li>职场背景核验与入职背调</li>
<li>家政人员背景核实与安全评估</li>
<li>个人履约能力评估与经济风险分析</li>
</ul>
</section>
</div>
</body>
</html>`
}
function main() {
const outputDir = path.join(__dirname, '../public/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}`)
console.log(`💡 配置与 useSEO.js 一致,当前域名: ${BASE_URL}`)
}
main()