feat: portal IA per spec (home entry point, /news, /proposals+redirect, /support), live search + suggestions, article TOC, mobile disclosure menu, CMS preview styles, modernization pass 1
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Build-time search index (Astro static endpoint — no server, no dependencies).
|
||||
// Kept lean: title/description/category/date/slug only (~60 KB for 200+ articles).
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function GET() {
|
||||
const posts = await getCollection('news', ({ data }) => !data.draft);
|
||||
const index = posts
|
||||
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
|
||||
.map((p) => ({
|
||||
slug: p.id,
|
||||
title: p.data.title,
|
||||
description: p.data.description,
|
||||
category: p.data.category,
|
||||
date: p.data.date.toISOString().slice(0, 10),
|
||||
}));
|
||||
return new Response(JSON.stringify(index), {
|
||||
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user