21 lines
790 B
TypeScript
21 lines
790 B
TypeScript
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' } });
|
|
}
|