NexoFlow
Docs · nexoflow-sdk Posts

Content Writernexoflow-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 post

Only 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

MethodOptionValues
listpage1-based page number
listlimitPosts per page: default 20, max 100 (all and iter fetch 100 at a time)
list, all, itertag, categoryOnly posts with that exact tag or category
list, all, itersort"newest" (default) | "oldest"
getformat"html" (default) | "markdown"
getstyledtrue 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:

FieldUse it for
pathThe post's URL, already built from your permalink structure
metaTitle, metaDescriptionThe page's head tags
focusKeywordThe post's main search phrase, or null (single post only)
noIndex, noFollowThe robots meta tag, when true
readingTimeMinutesA “6 min read” label, when siteFeatures.enableReadingTime is on
featuredImageUrlAn absolute URL, ready for an img tag
contentStylesThe CSS for the body and its FAQ (single post only)
faqQuestion and answer pairs for FAQPage JSON-LD (single post only)
relatedArticlesCards for the related posts chosen in the editor (single post only)
siteFeaturesThe 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