@wazobiatech/site-kit
v2.0.0
Published
Shared site integration package for Muse CMS — headless core + optional UI components
Readme
@wazobiatech/site-kit
Shared site integration package for Muse CMS — headless core + optional UI components for Next.js blogs: data services, cached queries, article body rendering, SEO route helpers (sitemap, RSS, robots.txt, revalidation webhook), and a small set of UI components.
Installation
npm install @wazobiatech/site-kitPeer dependencies (must already be in your project): react >=18, react-dom >=18, next >=14, @apollo/client >=3, graphql >=16.
See docs/USAGE.md for the full integration guide.
Rendering article body content
renderArticleBody is the shared renderer for muse article body HTML. It handles the edge cases every consumer site used to reinvent: muse @url: template tokens on inline URLs, contenteditable editor markup (which triggers React's "contentEditable with managed children" warning), muse's broken <picture> markup (collapsed to a single <img>), non-absolute srcset entries, and missing image dimensions / lazy-loading attributes.
Run renderArticleBody after sanitizeHtmlContent so the sanitizer's allowlist controls which tags survive into the renderer. The bundled sanitizer already permits <img> / <picture> / <figure> and friends.
Raw HTML (e.g. for dangerouslySetInnerHTML):
import { sanitizeHtmlContent, renderArticleBody } from '@wazobiatech/site-kit'
const sanitized = sanitizeHtmlContent(post.content, imageBaseUrl, siteUrl)
const html = renderArticleBody(sanitized, {
defaultImageWidth: 760, // default
defaultImageHeight: 428, // default
})
// <div dangerouslySetInnerHTML={{ __html: html }} />React (via the optional ui entry):
import { ArticleBody } from '@wazobiatech/site-kit/ui'
export function Article({ html }: { html: string }) {
return <ArticleBody html={html} className="prose" />
}processArticleBody and processArticleHtml are exported as aliases of renderArticleBody for backwards compatibility with existing consumer code.
Existing React renderers (html-react-parser walkers, custom components) can either adopt renderArticleBody for the server-side string and keep their React renderer, or replace their walker with the ArticleBody component.
Entry points
@wazobiatech/site-kit— headless core (services, queries, utilities, route helpers)@wazobiatech/site-kit/ui— React components (ArticleBody,ImageComponent,BlogPaginator,ShareButtons)@wazobiatech/site-kit/styles.css— CSS custom properties + component styles
