@oohmmm/next-blog
v0.2.1
Published
Next.js helpers for OOHMMM blog integration.
Readme
@oohmmm/next-blog
Next.js integration helpers for OOHMMM blog content.
Install
npm install @oohmmm/blog-sdk @oohmmm/next-blogOne-Command Setup (CLI)
Run this from your tenant website repo:
npx @oohmmm/next-blog connectThe CLI opens your browser, lets you sign in, select (or create) a tenant, and then writes:
OOHMMM_PLATFORM_URLOOHMMM_SITE_IDOOHMMM_SITE_SLUGOOHMMM_READ_TOKENOOHMMM_WEBHOOK_SECRETOOHMMM_CANONICAL_SITE_URL
to .env.local.
By default it also creates app/api/oohmmm/revalidate/route.ts if missing.
Load Blog Content
import { getTenantPosts, getTenantPostBySlug } from "@oohmmm/next-blog";
const { posts } = await getTenantPosts({ limit: 24 });
const { post } = await getTenantPostBySlug("what-is-crypto-prop-trading");Search (MVP Rules)
import { searchPostsByMvpRules } from "@oohmmm/next-blog";
const filtered = searchPostsByMvpRules(posts, query);Search matches title, description, and category only.
Revalidate Route (Tenant App)
// app/api/oohmmm/revalidate/route.ts
import { createOohmmmRevalidateHandler } from "@oohmmm/next-blog";
const webhookSecret = process.env.OOHMMM_WEBHOOK_SECRET!;
export const POST = createOohmmmRevalidateHandler({
webhookSecret,
defaultPaths: ["/blog"],
});Required Env Vars
OOHMMM_PLATFORM_URLOOHMMM_SITE_IDorOOHMMM_SITE_SLUGOOHMMM_READ_TOKENOOHMMM_WEBHOOK_SECRET(for revalidation endpoint)
