新增内容引擎文章发布接口与详情页
This commit is contained in:
@@ -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' } });
|
||||
}
|
||||
Reference in New Issue
Block a user