SDK Reference
The SEO API provides tools to improve your content's search engine visibility. Generate sitemaps, RSS feeds, and structured data with minimal code.
| Method | Description | Returns |
|---|---|---|
| Get article with SEO metadata | Promise<ApiResponse<ArticleWithSeo>> | |
| Generate sitemap (XML or JSON) | Promise<string | Sitemap> | |
| Generate RSS 2.0 feed | Promise<string> | |
| Get JSON-LD structured data | Promise<ApiResponse<StructuredDataResponse>> |
Retrieve an article with complete SEO metadata for use in meta tags.
Method Signature
async client.seo.getArticle(slug: string, baseUrl?: string): Promise<ApiResponse<ArticleWithSeo>>| Property | Type | Description | Default |
|---|---|---|---|
id* | string | - | - |
title* | string | - | - |
slug* | string | - | - |
content* | string | - | - |
seo* | SeoMetadata | SEO metadata | - |
project* | { name, slug, description } | - | - |
app/blog/[slug]/page.tsximport { SimplistClient } from "@simplist.blog/sdk"
import type { Metadata } from "next"
export async function generateMetadata({
params
}: {
params: { slug: string }
}): Promise<Metadata> {
// Uses SIMPLIST_API_KEY from environment variables
const client = new SimplistClient()
const { data: article } = await client.seo.getArticle(
params.slug,
'https://myblog.com'
)
return {
title: article.seo.metaTitle,
description: article.seo.metaDescription,
keywords: article.seo.keywords,
authors: article.seo.author ? [{ name: article.seo.author }] : undefined,
openGraph: {
title: article.seo.ogTitle || article.seo.metaTitle,
description: article.seo.ogDescription || article.seo.metaDescription,
images: article.seo.ogImage ? [article.seo.ogImage] : undefined,
type: 'article',
publishedTime: article.seo.publishedTime,
modifiedTime: article.seo.modifiedTime
},
twitter: {
card: article.seo.twitterCard,
title: article.seo.twitterTitle || article.seo.metaTitle,
description: article.seo.twitterDescription || article.seo.metaDescription,
images: article.seo.twitterImage ? [article.seo.twitterImage] : undefined
},
alternates: {
canonical: article.seo.canonicalUrl
}
}
}Generate a sitemap for your articles in XML or JSON format.
Method Signature
async client.seo.getSitemap(baseUrl: string, format: 'xml' | 'json' = 'xml', path?: string): Promise<string | Sitemap>import { SimplistClient } from "@simplist.blog/sdk"
export async function GET() {
// Uses SIMPLIST_API_KEY from environment variables
const client = new SimplistClient()
const sitemapXml = await client.seo.getSitemap(
'https://myblog.com',
'xml',
'blog' // Articles at myblog.com/blog/article-slug
)
return new Response(sitemapXml, {
headers: {
'Content-Type': 'application/xml',
'Cache-Control': 'public, max-age=3600'
}
})
}Generate an RSS 2.0 feed for your articles.
Method Signature
async client.seo.getRssFeed(baseUrl: string, limit: number = 20, path?: string): Promise<string>app/feed.xml/route.tsimport { SimplistClient } from "@simplist.blog/sdk"
export async function GET() {
// Uses SIMPLIST_API_KEY from environment variables
const client = new SimplistClient()
const rssXml = await client.seo.getRssFeed(
'https://myblog.com',
50, // Include last 50 articles
'blog' // Articles at myblog.com/blog/article-slug
)
return new Response(rssXml, {
headers: {
'Content-Type': 'application/xml',
'Cache-Control': 'public, max-age=3600'
}
})
}Get JSON-LD structured data for all articles. Useful for search engine rich results.
Method Signature
async client.seo.getStructuredData(baseUrl?: string): Promise<ApiResponse<StructuredDataResponse>>| Property | Type | Description | Default |
|---|---|---|---|
project* | { name, slug, description } | - | - |
articles* | Array<{ slug, structuredData }> | - | - |
generatedAt* | string | ISO 8601 timestamp | - |
const { data } = await client.seo.getStructuredData('https://myblog.com')
// Add to each article page
data.articles.forEach(article => {
console.log(`Article: ${article.slug}`)
console.log(JSON.stringify(article.structuredData, null, 2))
})
// Example structured data format:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Getting Started with Simplist",
"author": {
"@type": "Person",
"name": "John Doe"
},
"datePublished": "2025-01-15T10:30:00Z",
"dateModified": "2025-01-20T14:00:00Z",
"image": "https://cdn.simplist.blog/covers/getting-started.jpg",
"publisher": {
"@type": "Organization",
"name": "My Blog",
"logo": {
"@type": "ImageObject",
"url": "https://myblog.com/logo.png"
}
}
}A complete example of a Next.js article page with full SEO metadata and structured data.
import { SimplistClient } from "@simplist.blog/sdk"
import type { Metadata } from "next"
// Uses SIMPLIST_API_KEY from environment variables
const client = new SimplistClient()
export async function generateMetadata({
params
}: {
params: { slug: string }
}): Promise<Metadata> {
const { data: article } = await client.seo.getArticle(
params.slug,
process.env.NEXT_PUBLIC_BASE_URL
)
return {
title: article.seo.metaTitle,
description: article.seo.metaDescription,
keywords: article.seo.keywords,
openGraph: {
title: article.seo.ogTitle || article.title,
description: article.seo.ogDescription || article.excerpt,
images: article.seo.ogImage ? [article.seo.ogImage] : undefined,
type: 'article'
},
twitter: {
card: article.seo.twitterCard,
title: article.seo.twitterTitle || article.title,
description: article.seo.twitterDescription || article.excerpt
}
}
}These SDK methods use the following API endpoints:
getArticle()→ GET/v1/seo/article/:sluggetSitemap()→ GET/v1/seo/sitemapgetRssFeed()→ GET/v1/seo/rssgetStructuredData()→ GET/v1/seo/structured-data
- Cache sitemaps and RSS: Use HTTP caching headers (max-age: 3600)
- Update frequency: Regenerate sitemaps when content changes
- Canonical URLs: Always set canonical URLs to avoid duplicate content
- Structured data: Include JSON-LD on every article page
Quick Help
Generate sitemaps at runtime using Next.js Route Handlers (/sitemap.xml/route.ts). This ensures your sitemap is always up-to-date when new articles are published.
Both are valid XML formats. 'xml' returns a complete sitemap with <?xml> declaration, while 'urlset' returns just the <urlset> if you need to combine multiple sitemaps.
Use getRssFeed() which includes title, excerpt, and publication date. For custom fields, you'll need to generate the RSS manually or extend the SDK.