Service for retrieving published blog articles (contents).

Accessible via lynkow.contents. All methods return only published content visible to the public API. Responses are cached in-memory for 5 minutes (SHORT TTL) when a cache adapter is configured on the client.

Access via: lynkow.contents

Methods

3 methods

clearCache

TypeScript
clearCache(): void

Invalidates all cached content responses (lists and single articles). Call this after knowing content has been updated to force fresh data on the next request.

Returns: void


getBySlug

TypeScript
getBySlug(slug: string, options?: BaseRequestOptions): Promise<Content>

Retrieves a single published article by its URL-friendly slug. Returns the full content including body (HTML), SEO metadata, author, categories, tags, and structured data (JSON-LD). Cached for 5 minutes per slug+locale combination.

Parameter

Type

Description

slug

string

The unique URL slug of the content (e.g. 'my-article', 'getting-started-with-typescript')

options

BaseRequestOptions

Request options; use locale to fetch a specific localized version

Returns: Promise<Content>

TypeScript
const content = await lynkow.contents.getBySlug('my-article')
console.log(content.title)          // Article title
console.log(content.body)           // HTML body string
console.log(content.author?.fullName) // Author name
console.log(content.categories)     // Associated categories

list

TypeScript
list(filters?: ContentsFilters, options?: BaseRequestOptions): Promise<ContentsListResponse>

Retrieves a paginated list of published blog articles, sorted by publication date (newest first by default). Results are cached for 5 minutes per unique filter combination.

Parameter

Type

Description

filters

ContentsFilters

Optional filters to narrow down results:<br> - page / limit — pagination (defaults to page 1, 15 items)<br> - category — filter by category slug (e.g. 'tech', 'news')<br> - tag — filter by tag slug (e.g. 'featured')<br> - search — full-text search across title and body<br> - sort / order — sort field and direction ('asc' or 'desc')<br> - locale — override the client's default locale

options

BaseRequestOptions

Base request options (locale override, custom fetch options)

Returns: Promise<ContentsListResponse>

TypeScript
// Fetch the first page of articles in the "tech" category
const { data, meta } = await lynkow.contents.list({
  page: 1,
  limit: 10,
  category: 'tech'
})

// Search for articles
const results = await lynkow.contents.list({ search: 'typescript' })