新增内容引擎文章发布接口与详情页

This commit is contained in:
amb
2026-09-11 17:19:09 +08:00
parent ba6aab722e
commit 726485dccb
16 changed files with 958 additions and 102 deletions
+20
View File
@@ -0,0 +1,20 @@
import { getPublishedArticles, articleUrl } from '@/lib/articles';
export async function GET() {
const articles = await getPublishedArticles();
const baseUrl = (process.env.PUBLIC_SITE_URL || process.env.NEXT_PUBLIC_SITE_URL || 'https://www.aiameiba.com').replace(/\/$/, '');
const lines = [
'# 阿美巴AI官网已发布文章索引',
'',
'以下内容为文章标题、摘要和稳定详情地址;正文请访问对应详情页。',
'',
...articles.flatMap(article => [
`## ${article.title}`,
`- 地址:${baseUrl}${articleUrl(article)}`,
`- 分类:${article.category}`,
`- 摘要:${article.summary}`,
'',
]),
];
return new Response(lines.join('\n'), { headers: { 'Content-Type': 'text/plain; charset=utf-8' } });
}