feat(frontend): 首页改版——Hero合并广告位(2/3)、去PaaS/去对话卡、价值区/技能榜/应用中心文案、源index.html去HashRouter脚本、prerender去重注入

This commit is contained in:
QihuAI Design committed 2026-07-13 16:21:42 +08:00
1 parent c7fea64ae7
commit a7b9b2492e
5 files changed
+64 -72

No files matched your search

+15 -7
View File
@@ -39,9 +39,9 @@ if (html.includes(rootOpen)) {
'<div id="root">' + ssrHtml + '</div></body>');
}
// 4) 注入 SEO/GEO <head> 元数据(head 中的 JSON-LD 在 JS 挂载后仍保留;#root 内由组件渲染的 JSON-LD 供非JS爬虫读取)
const title = '七虎AI · 个人体验 AI、办公提效与 AI 创收的一站式 PaaS 平台';
const desc = '七虎AI 是面向个人与职场用户的 AI PaaS 平台:低价订阅无限 Token、垂直办公模板、可交易技能市场、AI 创作试炼场与低成本养模型,让每个人用 AI 把事做成。';
// 4) SEO/GEO <head> 元数据:替换已有 title/description(避免重复),再注入 og/canonical/JSON-LD
const title = '七虎AI · 个人体验 AI、办公提效与 AI 创收的一站式平台';
const desc = '七虎AI 是面向个人与职场用户的 AI 平台:低价订阅无限 Token、垂直办公模板、可交易技能市场、AI 创作试炼场与低成本养模型,让每个人用 AI 把事做成。';
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'SoftwareApplication',
@@ -52,9 +52,15 @@ const jsonLd = {
aggregateRating: { '@type': 'AggregateRating', ratingValue: '4.8', reviewCount: '1000' },
url: 'https://ai.qihuyun.com/',
};
const headInject = [
` <title>${title}</title>`,
` <meta name="description" content="${desc}" />`,
// 替换/新增 title 与 description(避免与源模板重复)
html = html.replace(/<title>[\s\S]*?<\/title>/, ` <title>${title}</title>`);
if (/<meta name="description"/.test(html)) {
html = html.replace(/<meta name="description"[^>]*>/, ` <meta name="description" content="${desc}" />`);
} else {
html = html.replace('</head>', ` <meta name="description" content="${desc}" />\n </head>`);
}
// 注入 og / canonical / JSON-LD(仅在尚不存在时,防止重复注入)
const extra = [
` <meta property="og:title" content="${title}" />`,
` <meta property="og:description" content="${desc}" />`,
` <meta property="og:type" content="website" />`,
@@ -62,7 +68,9 @@ const headInject = [
` <link rel="canonical" href="https://ai.qihuyun.com/" />`,
` <script type="application/ld+json">${JSON.stringify(jsonLd)}</script>`,
].join('\n');
html = html.replace('</head>', headInject + '\n </head>');
if (!html.includes('rel="canonical"')) {
html = html.replace('</head>', extra + '\n </head>');
}
fs.writeFileSync(path.join(OUT, 'index.html'), html);