feat: 全量落地后端与功能闭环
- 真实后端(server/):SQLite 存储 + scrypt 会话鉴权 + SMTP 邮件 - auth 注册/登录/登出/me/资料更新 - contact 联系表单(落库+邮件)、newsletter 订阅(去重) - favorites 作品收藏、comments 新闻评论、account 管理收件箱 - 用户系统 UI:个人中心 /account(资料/收藏/评论/管理员面板)、 收藏按钮、评论组件、登录/注册弹窗接真实 API(useApiError 错误映射) - 内容单点事实源:app/data/news|work 消除三处重复,页面全部引用 - 修复断链:首页动态/作品卡可点击、分享按钮真实动作、移除 # 死链、 语言切换器、社交链接统一 siteConfig - SEO:动态 sitemap/robots、JSON-LD、脚本生成真实 og-image.png - 列表增强:搜索 + 加载更多 - 部署自动化:build-and-push.sh 支持 git tag 版本化镜像; deploy.sh 一条命令构建推送+注入 Secret/ConfigMap+kubectl 滚动升级; deployment 挂 PVC 持久化;Dockerfile 支持 better-sqlite3 原生编译 - 组件注册去目录前缀,修复 AppLoader/AnimatedButton 等未渲染问题
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { getConfig } from '../utils/config'
|
||||
import { newsItems } from '../../app/data/news'
|
||||
import { workItems } from '../../app/data/work'
|
||||
|
||||
/**
|
||||
* 动态站点地图 /sitemap.xml。
|
||||
* 路由与数据均来自单一事实源(app/data/*),内容更新无需手工同步。
|
||||
*/
|
||||
export default defineEventHandler(() => {
|
||||
const { siteUrl } = getConfig()
|
||||
|
||||
const urls: Array<{ loc: string; changefreq: string; priority: string }> = [
|
||||
{ loc: '/', changefreq: 'weekly', priority: '1.0' },
|
||||
{ loc: '/studio', changefreq: 'monthly', priority: '0.8' },
|
||||
{ loc: '/work', changefreq: 'weekly', priority: '0.8' },
|
||||
{ loc: '/news', changefreq: 'weekly', priority: '0.8' },
|
||||
{ loc: '/tools', changefreq: 'monthly', priority: '0.6' },
|
||||
{ loc: '/contact', changefreq: 'monthly', priority: '0.6' },
|
||||
]
|
||||
|
||||
for (const item of workItems) {
|
||||
urls.push({ loc: `/work/${item.slug}`, changefreq: 'monthly', priority: '0.7' })
|
||||
}
|
||||
for (const item of newsItems) {
|
||||
urls.push({ loc: `/news/${item.slug}`, changefreq: 'weekly', priority: '0.7' })
|
||||
}
|
||||
|
||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
${urls
|
||||
.map(
|
||||
(u) => ` <url>
|
||||
<loc>${siteUrl}${u.loc}</loc>
|
||||
<changefreq>${u.changefreq}</changefreq>
|
||||
<priority>${u.priority}</priority>
|
||||
</url>`,
|
||||
)
|
||||
.join('\n')}
|
||||
</urlset>`
|
||||
|
||||
return new Response(xml, {
|
||||
headers: { 'Content-Type': 'text/xml; charset=utf-8' },
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user