feat: SEO/GEO升级——SSR趋势列表/详情页、sitemap动态化(每日趋势URL)、llms.txt趋势说明;小程序sitemap.json搜索收录+趋势分享动态标题;看板移动端溢出修复
This commit is contained in:
@@ -58,15 +58,15 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.page { display: flex; flex-direction: column; gap: 16px; }
|
.page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
|
||||||
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
|
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
|
||||||
.card { background: #fff; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
|
.card { background: #fff; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
|
||||||
.card b { font-size: 24px; color: #1f2333; }
|
.card b { font-size: 24px; color: #1f2333; }
|
||||||
.card span { font-size: 13px; color: #6b7080; }
|
.card span { font-size: 13px; color: #6b7080; }
|
||||||
.card i { font-size: 11px; color: #a6abbb; font-style: normal; }
|
.card i { font-size: 11px; color: #a6abbb; font-style: normal; }
|
||||||
.row { display: grid; grid-template-columns: 300px 1fr; gap: 12px; }
|
.row { display: grid; grid-template-columns: 300px 1fr; gap: 12px; min-width: 0; }
|
||||||
@media (max-width: 900px) { .row { grid-template-columns: 1fr; } }
|
@media (max-width: 900px) { .row { grid-template-columns: 1fr; } }
|
||||||
.panel { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
|
.panel { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); min-width: 0; overflow-x: auto; }
|
||||||
.panel h3 { margin: 0 0 12px; font-size: 14px; color: #1f2333; }
|
.panel h3 { margin: 0 0 12px; font-size: 14px; color: #1f2333; }
|
||||||
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
|
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
|
||||||
.bar-name { width: 64px; font-size: 12px; color: #6b7080; flex-shrink: 0; }
|
.bar-name { width: 64px; font-size: 12px; color: #6b7080; flex-shrink: 0; }
|
||||||
|
|||||||
@@ -200,10 +200,13 @@ function getSampleData() {
|
|||||||
|
|
||||||
// 微信小程序分享
|
// 微信小程序分享
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
onShareAppMessage(() => ({
|
onShareAppMessage(() => {
|
||||||
title: 'AI 维度 - 你的AI知识助手',
|
const latest = (items.value || [])[0]
|
||||||
path: '/pages/index/index'
|
return {
|
||||||
}))
|
title: latest ? `今日AI速递:${String(latest.title).slice(0, 24)}… · AI维度` : 'AI 维度 · 每天 5 分钟看懂 AI 大事',
|
||||||
|
path: '/pages/trend/trend'
|
||||||
|
}
|
||||||
|
})
|
||||||
// #endif
|
// #endif
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [
|
||||||
|
{ "action": "allow", "page": "*" }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
const { Trend } = require('../models')
|
||||||
|
|
||||||
|
const esc = (x) => String(x == null ? '' : x).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||||
|
|
||||||
// 反代场景下优先取 x-forwarded 头,保证 sitemap/robots 里的站点地址正确
|
// 反代场景下优先取 x-forwarded 头,保证 sitemap/robots 里的站点地址正确
|
||||||
function origin(req) {
|
function origin(req) {
|
||||||
@@ -42,13 +45,21 @@ router.get('/robots.txt', (req, res) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/sitemap.xml', (req, res) => {
|
router.get('/sitemap.xml', async (req, res) => {
|
||||||
const o = origin(req)
|
const o = origin(req)
|
||||||
const today = new Date().toISOString().slice(0, 10)
|
const today = new Date().toISOString().slice(0, 10)
|
||||||
const urls = ['/', '/pages/trend/trend', '/pages/chat/chat', '/pages/dimension/dimension']
|
let trendUrls = ''
|
||||||
|
try {
|
||||||
|
const items = await Trend.find({}).sort({ newsDate: -1 }).limit(20).lean()
|
||||||
|
trendUrls = items.map((t) => ` <url><loc>${o}/trends/${t._id}</loc><lastmod>${(t.newsDate || t.createdAt || new Date()).toISOString().slice(0, 10)}</lastmod><changefreq>daily</changefreq></url>`).join('\n')
|
||||||
|
} catch (e) { /* 数据库不可用时仅输出基础页 */ }
|
||||||
res.type('application/xml').send(
|
res.type('application/xml').send(
|
||||||
`<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n` +
|
`<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n` +
|
||||||
urls.map((u) => ` <url><loc>${o}${u}</loc><lastmod>${today}</lastmod></url>`).join('\n') +
|
[` <url><loc>${o}/</loc><lastmod>${today}</lastmod><changefreq>daily</changefreq></url>`,
|
||||||
|
` <url><loc>${o}/trends</loc><lastmod>${today}</lastmod><changefreq>daily</changefreq></url>`,
|
||||||
|
` <url><loc>${o}/about</loc><changefreq>monthly</changefreq></url>`,
|
||||||
|
` <url><loc>${o}/llms.txt</loc><changefreq>weekly</changefreq></url>`].join('\n') +
|
||||||
|
(trendUrls ? '\n' + trendUrls : '') +
|
||||||
`\n</urlset>`
|
`\n</urlset>`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -62,7 +73,7 @@ router.get('/llms.txt', (req, res) => {
|
|||||||
|
|
||||||
## 核心内容
|
## 核心内容
|
||||||
- 五维度知识体系:AI起源、发展脉络、当前格局、学习工具、趋势跟踪
|
- 五维度知识体系:AI起源、发展脉络、当前格局、学习工具、趋势跟踪
|
||||||
- 每日AI趋势:定时采集行业热点(融资、产品发布、论文)
|
- 每日AI趋势:每天 8:00/20:00 自动采集 Hacker News / arXiv 热点并中文归类(产品/论文/工具/公司/政策)
|
||||||
- AI问答:基于知识库的智能问答
|
- AI问答:基于知识库的智能问答
|
||||||
|
|
||||||
## 免费与付费
|
## 免费与付费
|
||||||
@@ -70,7 +81,7 @@ router.get('/llms.txt', (req, res) => {
|
|||||||
|
|
||||||
## 链接
|
## 链接
|
||||||
- [常见问题与产品说明](${o}/about)
|
- [常见问题与产品说明](${o}/about)
|
||||||
- [在线使用](${o}/)
|
- [在线使用](${o}/)\n- [每日AI趋势速递](${o}/trends)
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user