Skip to content

About

JSON and JSON Feed for Yamb

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

yamb-render-json

npm version Build status Coverage status Dependency status

Export Yamb posts and collections as source JSON views or JSON Feed 1.1 objects.

For GitHub Packages, route the @yamb scope to https://npm.pkg.github.com and install @yamb/render-json.

Quick start

Requires Node.js 26.13 or later and yamb 1.1.0 or later. Direct rendering needs no storage.

pnpm add yamb yamb-render-json
import { feed, json } from 'yamb-render-json';

const source = {
  id: 'hello',
  uri: '2026/11/hello',
  title: 'Hello',
  text: '**Hello**, world.',
  status: 'published',
  publishedAt: '2026-11-12T09:00:00Z',
  updatedAt: '2026-11-12T09:00:00Z'
};

const ctx = {
  base: new URL('https://example.com/blog'),
  timeZone: 'UTC'
};

const renderer = json();

const post = await renderer.post(source, ctx);
const collection = await renderer.collection(
  {
    posts: [source],
    view: 'full'
  },
  ctx
);

console.log(
  JSON.stringify({
    post,
    collection
  })
);

const news = feed({
  title: 'My blog',
  feed: 'https://example.com/blog/feed.json'
});

const result = await news.collection(
  {
    posts: [source]
  },
  ctx
);

console.log(JSON.stringify(result));

Reference

Author

Alexey Simonenko

License

MIT. See LICENSE.

About

JSON and JSON Feed for Yamb

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages