Service for retrieving SEO-related files (sitemap, robots.txt, LLM-optimized content, and individual Markdown exports).

Accessible via lynkow.seo. All methods return plain text (XML, TXT, or Markdown) and are NOT cached by the SDK since they are typically served as route handlers with their own HTTP caching headers.

Access via: lynkow.seo

Methods

6 methods

getMarkdown

TypeScript
getMarkdown(contentPath: string, options?: BaseRequestOptions): Promise<string>

Retrieves a single content article or page as Markdown by its public URL path. The SDK appends .md to the path automatically. This is useful for exposing individual content items to LLMs or for Markdown-based rendering pipelines.

Parameter

Type

Description

contentPath

string

The content's public URL path (must start with / or will be auto-prefixed):<br> - For blog articles: use Content.path directly (already includes locale prefix)<br> - For pages in single-language sites: use Page.path directly<br> - For pages in multi-language sites: prepend the locale manually,<br> e.g. /${page.locale}${page.path}

options

BaseRequestOptions

Request options (custom fetch options)

Returns: Promise<string>

TypeScript
// Get a blog article as Markdown (path includes locale automatically)
const article = await lynkow.contents.getBySlug('my-article')
const md = await lynkow.seo.getMarkdown(article.path)

// Get a page as Markdown (mono-language)
const page = await lynkow.pages.getBySlug('about')
const md = await lynkow.seo.getMarkdown(page.path!)

// Get a page as Markdown (multi-language — prepend locale)
const page = await lynkow.pages.getBySlug('about')
const md = await lynkow.seo.getMarkdown(`/${page.locale}${page.path}`)

// In a Next.js catch-all route handler
export async function GET(req: Request) {
  const url = new URL(req.url)
  const path = url.pathname.replace(/\.md$/, '')
  const md = await lynkow.seo.getMarkdown(path)
  return new Response(md, {
    headers: { 'Content-Type': 'text/markdown; charset=utf-8' }
  })
}

llmsFullTxt

TypeScript
llmsFullTxt(options?: BaseRequestOptions): Promise<string>

Retrieves the llms-full.txt file, which concatenates all published articles and pages into a single Markdown document. Useful for AI/LLM ingestion of the site's full content. Can be large for sites with many articles. Supports locale-specific versions for multilingual sites.

Parameter

Type

Description

options

BaseRequestOptions

Request options:<br> - locale — fetch the full content for a specific locale (e.g. 'en').<br> When set, only content in that locale is included.

Returns: Promise<string>

TypeScript
// In a Next.js route handler (app/llms-full.txt/route.ts)
export async function GET() {
  const md = await lynkow.seo.llmsFullTxt()
  return new Response(md, {
    headers: { 'Content-Type': 'text/plain; charset=utf-8' }
  })
}

llmsTxt

TypeScript
llmsTxt(options?: BaseRequestOptions): Promise<string>

Retrieves the llms.txt file, an LLM-optimized site index in Markdown format. This file provides a structured overview of the site's content, designed for AI crawlers and language models to understand the site's structure. Supports locale-specific versions for multilingual sites.

Parameter

Type

Description

options

BaseRequestOptions

Request options:<br> - locale — fetch the index for a specific locale (e.g. 'en', 'fr').<br> When set, the API returns /{locale}/llms.txt. When omitted, returns<br> the default locale version.

Returns: Promise<string>

TypeScript
// In a Next.js route handler (app/llms.txt/route.ts)
export async function GET() {
  const md = await lynkow.seo.llmsTxt()
  return new Response(md, {
    headers: { 'Content-Type': 'text/plain; charset=utf-8' }
  })
}

// Fetch the French version
const md = await lynkow.seo.llmsTxt({ locale: 'fr' })

robots

TypeScript
robots(options?: BaseRequestOptions): Promise<string>

Retrieves the generated robots.txt file for the site, including crawl directives and sitemap references. Typically served as a route handler with Content-Type: text/plain.

Parameter

Type

Description

options

BaseRequestOptions

Request options (custom fetch options)

Returns: Promise<string>

TypeScript
// In a Next.js route handler (app/robots.txt/route.ts)
export async function GET() {
  const txt = await lynkow.seo.robots()
  return new Response(txt, {
    headers: { 'Content-Type': 'text/plain' }
  })
}

sitemap

TypeScript
sitemap(options?: BaseRequestOptions): Promise<string>

Retrieves the complete XML sitemap for the site. If the site uses Sitemap Index mode, this returns the index file pointing to individual parts. Typically served as a route handler with Content-Type: application/xml.

Parameter

Type

Description

options

BaseRequestOptions

Request options (custom fetch options)

Returns: Promise<string>

TypeScript
// In a Next.js route handler (app/sitemap.xml/route.ts)
export async function GET() {
  const xml = await lynkow.seo.sitemap()
  return new Response(xml, {
    headers: { 'Content-Type': 'application/xml' }
  })
}

sitemapPart

TypeScript
sitemapPart(part: number, options?: BaseRequestOptions): Promise<string>

Retrieves a specific sitemap part when Sitemap Index mode is enabled. Each part contains a subset of URLs, useful for large sites that exceed the 50,000 URL limit per sitemap file.

Parameter

Type

Description

part

number

The 1-indexed part number (e.g. 1, 2, 3)

options

BaseRequestOptions

Request options (custom fetch options)

Returns: Promise<string>

TypeScript
// In a Next.js dynamic route handler (app/sitemap-[part].xml/route.ts)
export async function GET(req: Request, { params }: { params: { part: string } }) {
  const xml = await lynkow.seo.sitemapPart(parseInt(params.part))
  return new Response(xml, {
    headers: { 'Content-Type': 'application/xml' }
  })
}