Getting Started
astro-jsonfeed generates a JSON Feed for your Astro site. It works with blogs, changelogs, or any other chronological content.
Installation
Section titled “Installation”Install the package using your preferred package manager:
sh npm install astro-jsonfeed
sh pnpm add astro-jsonfeed
sh yarn add astro-jsonfeed
Create a file in src/pages/ with the extension .json.js or .json.ts. A common convention is feed.json.
import jsonFeed from "astro-jsonfeed";
export function GET(context) { return jsonFeed({ title: "Arrietty's Blog", description: "Notes from under the floorboards.", items: [ { id: "/kitchen", url: new URL("/kitchen", context.site).href, title: "First Expedition to the Kitchen", content_text: "Father finally said I could come up. Up! Through the wall, past the clock, all the way to the kitchen.", content_html: "<p>Father finally said I could come up. Up! Through the wall, past the clock, all the way to the kitchen.</p>", date_published: "2026-05-25T23:30:15-04:00", tags: ["borrows"], }, ], });}The response will have Content-Type: application/feed+json set automatically.
Named exports
Section titled “Named exports”If you prefer named imports, both getJsonFeedResponse and getJsonFeedString are available:
import { getJsonFeedResponse, getJsonFeedString } from "astro-jsonfeed";See the API reference for the full list of options.
Built by Myles with love in Toronto, Canada.