diff --git a/client/index.html b/client/index.html index 119180d..ce9167d 100644 --- a/client/index.html +++ b/client/index.html @@ -2,14 +2,38 @@ - + - 宇之然AI维度 - AI 知识探索社区 - - + 宇之然AI维度 - AI知识探索社区 | 五维度系统学AI + + + + + + + + + + + + + + + -
+
- \ No newline at end of file + diff --git a/server/src/routes/seo.js b/server/src/routes/seo.js new file mode 100644 index 0000000..4839768 --- /dev/null +++ b/server/src/routes/seo.js @@ -0,0 +1,102 @@ +import express from 'express' +import fs from 'node:fs' +import path from 'node:path' +import { fileURLToPath } from 'node:url' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const router = express.Router() + +const SITE = process.env.SITE_URL || '' +const origin = (req) => (SITE ? SITE.replace(/\/$/, '') : `${req.protocol}://${req.get('host')}`) + +const DESC = + '宇之然AI维度:从五个维度(AI起源、发展、当前格局、学习工具、趋势跟踪)系统理解人工智能的知识探索社区。每日更新AI行业趋势与热点,支持问答、收藏与学习进度跟踪。' + +const FAQ = [ + ['宇之然AI维度是什么?', '一个AI知识探索社区:从五个维度系统梳理人工智能的起源、发展、当前格局、学习工具与行业趋势,并每日更新AI热点。'], + ['适合谁使用?', 'AI 零基础入门者、关注AI行业动态的从业者、需要结构化AI知识体系的学生与内容创作者。'], + ['内容如何保持新鲜?', '内置AI趋势定时采集,每天两次更新行业热点;支持问答与知识扩展。'], + ['免费使用吗?', '基础浏览与问答免费,注册登录后可使用收藏与学习进度等完整功能。'], + ['有微信小程序吗?', '有。微信搜索"AI维度"即可使用,数据与网页端同步。'], +] + +router.get('/robots.txt', (req, res) => { + const o = origin(req) + res.type('text/plain').send( + [ + 'User-agent: *', + 'Allow: /', + 'Disallow: /api/', + '', + 'User-agent: GPTBot', + 'Allow: /', + 'User-agent: ClaudeBot', + 'Allow: /', + 'User-agent: PerplexityBot', + 'Allow: /', + '', + `Sitemap: ${o}/sitemap.xml`, + '', + ].join('\n') + ) +}) + +router.get('/sitemap.xml', (req, res) => { + const o = origin(req) + const today = new Date().toISOString().slice(0, 10) + const urls = ['/', '/pages/trend/trend', '/pages/chat/chat', '/pages/dimension/dimension'] + res.type('application/xml').send( + `\n\n` + + urls.map((u) => ` ${o}${u}${today}`).join('\n') + + `\n` + ) +}) + +router.get('/llms.txt', (req, res) => { + const o = origin(req) + res.type('text/markdown').send( + `# 宇之然AI维度 + +> ${DESC} + +## 核心内容 +- 五维度知识体系:AI起源、发展脉络、当前格局、学习工具、趋势跟踪 +- 每日AI趋势:定时采集行业热点(融资、产品发布、论文) +- AI问答:基于知识库的智能问答 + +## 免费与付费 +- 浏览与基础问答免费;注册登录解锁收藏与学习进度 + +## 链接 +- [常见问题与产品说明](${o}/about) +- [在线使用](${o}/) +` + ) +}) + +router.get('/about', (req, res) => { + const o = origin(req) + const faqHtml = FAQ.map(([q, a]) => `

${q}

${a}

`).join('') + const faqLd = JSON.stringify({ + '@context': 'https://schema.org', + '@type': 'FAQPage', + mainEntity: FAQ.map(([q, a]) => ({ '@type': 'Question', name: q, acceptedAnswer: { '@type': 'Answer', text: a } })), + }) + res.type('html').send(` + +宇之然AI维度 - 产品介绍与常见问题 | AI知识探索社区 + + + + + +AI 知识探索社区 +

宇之然AI维度

+

${DESC}

+

五个维度

  1. AI 起源与历史
  2. 技术发展脉络
  3. 当前行业格局
  4. 学习工具与资源
  5. 趋势跟踪
+

常见问题

${faqHtml} +

© ${new Date().getFullYear()} 宇之然 · 微信小程序搜索"AI维度"

+`) +}) + +export default router