Service for retrieving global site blocks (header, footer, navigation, etc.).

Accessible via lynkow.globals (aliased from lynkow.blocks). Global blocks are reusable, schema-driven content components shared across all pages of the site. They are resolved server-side with DataSources. Responses are cached for 10 minutes (MEDIUM TTL) since global blocks change infrequently.

Access via: lynkow.blocks

Methods

4 methods

clearCache

TypeScript
clearCache(): void

Invalidates all cached global block responses (site config and individual blocks). Call this after knowing global blocks have been updated to force fresh data on the next request.

Returns: void


getBySlug

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

Retrieves a single global block by its slug, with fully resolved DataSource data. Use this when you only need one specific block rather than all globals. Cached for 10 minutes per slug+locale.

Parameter

Type

Description

slug

string

The unique slug of the global block (e.g. 'header', 'footer', 'nav', 'sidebar')

options

BaseRequestOptions

Request options; use locale to fetch a localized version

Returns: Promise<GlobalBlockResponse>

TypeScript
const { data } = await lynkow.globals.getBySlug('header')
console.log(data.name)  // "Header"
console.log(data.data)  // Resolved content (links, logo, menu items, etc.)

global

TypeScript
global(slug: string, options?: BaseRequestOptions): Promise<GlobalBlockResponse>

Retrieves a single global block by slug.

Parameter

Type

Description

slug

string

The block slug

options

BaseRequestOptions

Request options

Returns: Promise<GlobalBlockResponse>

TypeScript
// Deprecated -- use getBySlug() instead:
const { data } = await lynkow.globals.getBySlug('footer')

siteConfig

TypeScript
siteConfig(options?: BaseRequestOptions): Promise<SiteConfigResponse>

Retrieves the complete site configuration including basic site info (name, domain, logo, favicon) and all global blocks resolved in a single request. This is the recommended way to fetch layout data for your site shell (header, footer, navigation). Cached for 10 minutes per locale.

Parameter

Type

Description

options

BaseRequestOptions

Request options; use locale to fetch localized block data

Returns: Promise<SiteConfigResponse>

TypeScript
const { data } = await lynkow.globals.siteConfig()
console.log(data.site.name)          // "My Site"
const header = data.globals['header'] // Resolved header block data
const footer = data.globals['footer'] // Resolved footer block data