Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import { getCollection } from "astro:content";
import type { APIContext } from "astro";
export async function GET(context: APIContext) {
const posts = await getCollection("blog");
const sorted = posts.sort(
(a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime(),
);
const siteUrl = context.site?.origin || "https://tubone-project24.xyz";
const postsList = sorted
.slice(0, 10)
.map((post) => {
const slug = post.slug;
const url = `${siteUrl}/${slug}/`;
const title = post.data.title;
const description = post.data.description || "";
return `- [${title}](${url}): ${description}`;
})
.join("\n");
const llmsTxtContent = `# tubone BOYAKI
> 技術ブログ by Yu Otsubo (tubone24). AIエージェント開発、AWS/クラウドインフラ、Web技術について執筆。
## 著者について
- GitHub: https://github.com/tubone24
- 技術書著者: 「やさしいMCP入門」「AIエージェント開発/運用入門」他
- 専門分野: AI Agent開発、Webアプリ開発、インフラストラクチャ
## 最新記事
${postsList}
## ライセンス
このコンテンツはクリエイティブ・コモンズ 表示 4.0 国際ライセンスの下で提供されています。
## 連絡先
- GitHub: https://github.com/tubone24
- Blog: ${siteUrl}
`;
return new Response(llmsTxtContent, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
}
|