Service for retrieving published pages (Site Blocks of type "page").
Accessible via lynkow.pages. Pages are CMS-managed, schema-driven content
blocks (e.g. "About", "Contact", legal pages). Unlike blog articles, pages
use DataSource-resolved data instead of a rich text body. Responses are
cached for 5 minutes (SHORT TTL) when a cache adapter is configured.
Access via: lynkow.pages
Methods
5 methods
clearCache
clearCache(): voidInvalidates all cached page responses (lists, slug lookups, path lookups, and JSON-LD data). Call this after knowing pages have been updated to force fresh data on the next request.
Returns: void
getByPath
getByPath(path: string, options?: BaseRequestOptions): Promise<Page>Retrieves a page by its full URL path, which may include nested segments
(e.g. /services/consulting). Useful when you have the path from a URL
but not the slug. Returns the same full page data as getBySlug().
Cached for 5 minutes per path+locale.
Parameter | Type | Description |
|---|---|---|
|
| The full URL path of the page (e.g. |
|
| Request options; use |
Returns: Promise<Page>
// Resolve a page from the current URL
const page = await lynkow.pages.getByPath('/services/consulting')
console.log(page.name) // "Consulting"getBySlug
getBySlug(slug: string, options?: BaseRequestOptions): Promise<Page>Retrieves a single page by its slug, including fully resolved DataSource data, SEO settings, and alternate locale versions. Cached for 5 minutes per slug+locale.
Parameter | Type | Description |
|---|---|---|
|
| The unique URL slug of the page (e.g. |
|
| Request options; use |
Returns: Promise<Page>
const page = await lynkow.pages.getBySlug('about')
console.log(page.data) // Resolved DataSource content
console.log(page.seo) // SEO metadata
console.log(page.alternates) // Other locale versionsgetJsonLd
getJsonLd(slug: string, options?: BaseRequestOptions): Promise<Record<string, unknown>>Retrieves Schema.org JSON-LD structured data for a page, ready to be
embedded in a <script type="application/ld+json"> tag for search
engine optimization. Cached for 5 minutes per slug+locale.
Parameter | Type | Description |
|---|---|---|
|
| The page slug to generate JSON-LD for (e.g. |
|
| Request options; use |
Returns: Promise<Record<string, unknown>>
const jsonLd = await lynkow.pages.getJsonLd('about')
// Embed in your HTML <head>
// <script type="application/ld+json">{JSON.stringify(jsonLd)}</script>list
list(options?: PagesListOptions): Promise<PagesListResponse>Retrieves a list of all published pages on the site. Optionally filter by tag to get a subset (e.g. legal documents). Returns page summaries without resolved data. Cached for 5 minutes per locale+tag.
Parameter | Type | Description |
|---|---|---|
|
| Request options:<br> - |
Returns: Promise<PagesListResponse>
// List all pages
const { data } = await lynkow.pages.list()
// List only legal documents
const { data } = await lynkow.pages.list({ tag: 'legal' })