SDK: @superduperseo/content
A typed client for the Content API. No dependencies; works in Node 18+, edge runtimes and Cloudflare Workers.
npm install @superduperseo/content
Set the site key in the server environment: SUPERDUPERSEO_CONTENT_KEY=sds_live_....
import { createClient } from '@superduperseo/content'
const cms = createClient() // reads SUPERDUPERSEO_CONTENT_KEY; or createClient({ key })
const hit = await cms.resolve('/blog/my-post')
if (hit?.type === 'redirect') return Response.redirect(hit.to, 301)
if (hit?.type === 'gone') return new Response(null, { status: 410 })
if (hit?.type === 'post') render(hit.post) // seo.title, head_html, title as <h1>, html
// null: not a blog page: render your own page or a real 404
| Method | Returns |
|---|---|
resolve(path) |
{ type: 'post', post }, { type: 'redirect', to, status: 301 }, { type: 'gone', status: 410 } or null |
site() |
Site name, routes, feed URL, structured data |
posts(page), allPosts() |
Post summaries, newest first |
post(slug) |
A full post; post.ctas has its calls to action as data, and stripCtas(html) drops our blocks for a site that draws its own (0.5.0 or later) |
author(slug, { language }), authors({ language }), topic(slug), topics() |
Author and topic pages; an author's page in a language has their job title and bio in it (0.4.0 or later) |
redirects() |
All 301s and 410s |
sitemapXml(), feedXml(), llmsTxt(), llmsFullTxt() |
Text to serve at /sitemap.xml, the feed URL, /llms.txt, /llms-full.txt (every page in full; 0.2.0 or later) |
indexNowKey() |
Serve it as text at /{key}.txt |
search(), changes() |
Search entries; what changed (by cursor) |
clearCache(file?) |
Drop cached copies (call it from your webhook) |
Responses are cached in memory for 60 seconds and revalidated with ETags. If SuperDuperSEO cannot be reached, the last good copy is served.
Since 0.6.0 the client sends its version with each request (the X-SuperDuperSEO-SDK header). When a newer one is out, Settings › Connection and our MCP answers say so. To update: npm install @superduperseo/content@latest in your site's code, then deploy.
Next.js helpers
import { metadataFor, jsonLd, revalidateRoute } from '@superduperseo/content/next'
export async function generateMetadata({ params }) { return metadataFor(await cms.post((await params).slug)) }
// <script type="application/ld+json" dangerouslySetInnerHTML={jsonLd(post)} />
export const POST = revalidateRoute({ secret: process.env.SUPERDUPERSEO_WEBHOOK_SECRET!, revalidate: revalidatePath })
Webhooks
verifyWebhook(secret, rawBody, signatureHeader) returns the event, or null when the signature is wrong or older than 5 minutes. See Webhooks.
Complete examples: Next.js starter, Cloudflare starter.