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
clearCache(): voidInvalidates 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
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 |
|---|---|---|
|
| The unique URL slug of the content (e.g. |
|
| Request options; use |
Returns: Promise<Content>
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 categorieslist
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 |
|---|---|---|
|
| Optional filters to narrow down results:<br> - |
|
| Base request options (locale override, custom fetch options) |
Returns: Promise<ContentsListResponse>
// 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' })