Docs · nexoflow-sdk Posts
nexoflow-sdk
Posts
Read your published posts: paginated lists, single posts, full archives, and slug lists for static generation.
Methods
nf.posts
nf.posts.list(params?, options?) // List posts (paginated)
nf.posts.get(slug, params?, options?) // Single post with full content
nf.posts.all(params?, options?) // ALL posts (auto-paginated)
nf.posts.slugs(options?) // All slugs (SSG / generateStaticParams)
nf.posts.iter(params?, options?) // Async iterator over every postOnly published posts come back, newest first unless you ask for oldest. A post scheduled for later stays out until its publish date, and get answers 404 for it.
List & get options
| Method | Option | Values |
|---|---|---|
| list | page | 1-based page number |
| list | limit | Posts per page: default 20, max 100 (all and iter fetch 100 at a time) |
| list, all, iter | tag, category | Only posts with that exact tag or category |
| list, all, iter | sort | "newest" (default) | "oldest" |
| get | format | "html" (default) | "markdown" |
| get | styled | true wraps the body in a styled container with its CSS |
Fields worth knowing
Beyond the title and body, each post carries what a good page needs:
| Field | Use it for |
|---|---|
path | The post's URL, already built from your permalink structure |
metaTitle, metaDescription | The page's head tags |
focusKeyword | The post's main search phrase, or null (single post only) |
noIndex, noFollow | The robots meta tag, when true |
readingTimeMinutes | A “6 min read” label, when siteFeatures.enableReadingTime is on |
featuredImageUrl | An absolute URL, ready for an img tag |
contentStyles | The CSS for the body and its FAQ (single post only) |
faq | Question and answer pairs for FAQPage JSON-LD (single post only) |
relatedArticles | Cards for the related posts chosen in the editor (single post only) |
siteFeatures | The site's on/off flags: on the single post, and once per list response |
Examples
Blog index with pagination
blog-index.ts
const { data } = await nf.posts.list({ limit: 12, category: "engineering" })
for (const post of data.posts) {
console.log(`${post.title} - ${post.excerpt}`)
}
if (data.pagination.hasMore) {
const { data: page2 } = await nf.posts.list({ limit: 12, page: 2 })
}Static site generation: all slugs
slugs.ts
const slugs = await nf.posts.slugs()
// [{ slug: "intro-to-nextjs" }, { slug: "deploy-to-vercel" }, ...]Async iterator: every post without manual pages
iterate.ts
for await (const post of nf.posts.iter({ category: "news" })) {
console.log(post.title)
}The page's head and robots tags
app/blog/[slug]/page.tsx
// app/blog/[slug]/page.tsx (Next.js App Router)
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
const { data: post } = await nf.posts.get(slug)
return {
title: post.metaTitle || post.title,
description: post.metaDescription ?? undefined,
keywords: post.focusKeyword ? [post.focusKeyword] : undefined,
robots: { index: !post.noIndex, follow: !post.noFollow },
}
}FAQ structured data
In HTML, the FAQ is already inside content as an accordion. The faq array is there for the structured data.
faq-jsonld.ts
// FAQPage JSON-LD from the post's FAQ, when schema markup is on
const faqLd =
post.siteFeatures.enableSchemaMarkup && post.faq.length > 0
? {
"@context": "https://schema.org",
"@type": "FAQPage",
mainEntity: post.faq.map((f) => ({
"@type": "Question",
name: f.question,
acceptedAnswer: { "@type": "Answer", text: f.answer },
})),
}
: null