Skip to content

Instantly share code, notes, and snippets.

View jonasvanderhaegen's full-sized avatar
🏠

Jonas Vanderhaegen jonasvanderhaegen

🏠
View GitHub Profile
@jonasvanderhaegen
jonasvanderhaegen / gist:0a0ec349ab9bd1f16727e80f7354e0bc
Last active April 19, 2026 09:08
Astro server endpoint — expose Content Collections as JSON API
// src/pages/api/docs/[lang].json.ts
// Expose Astro Content Collections as locale-aware static JSON endpoints.
// Outputs: /api/docs/en.json and /api/docs/nl.json at build time.
// No SSR or adapter required — works with default static output.
// unlisted entries are included in API but hidden from sidebar.
import type { APIRoute } from 'astro';
import { getCollection } from 'astro:content';
export function getStaticPaths() {
return [