Skip to content

awesomeem/emdash-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

@awesomeem/emdash-render

Reads EmDash CMS content from D1 and renders Portable Text to HTML. Built for Hono on Cloudflare Workers — ~14 KB bundle, ~2 ms CPU per request.

Why not Astro SSR?

Cloudflare free plan = 10 ms CPU limit. Astro SSR uses 10-20 ms. Hono uses ~2 ms.

API

import { getPosts, getPostBySlug, getPages, getPageBySlug, getCollection } from "@awesomeem/emdash-render";
import { portableTextToHtml } from "@awesomeem/emdash-render";

const posts = await getPosts(db);            // ec_posts, published, newest first
const post  = await getPostBySlug(db, slug); // single post by slug
const pages = await getPages(db);            // ec_pages, published, alphabetical
const page  = await getPageBySlug(db, slug); // single page by slug
const items = await getCollection(db, name); // any ec_* table

const html  = portableTextToHtml(post.content); // Portable Text JSON → HTML

All queries return only published, non-deleted content.

About

Direct-D1 reader for EmDash CMS — query helpers + Portable Text renderer for Hono/Workers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors