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
clearCache(): voidInvalidates 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
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 |
|---|---|---|
|
| The unique slug of the global block (e.g. |
|
| Request options; use |
Returns: Promise<GlobalBlockResponse>
const { data } = await lynkow.globals.getBySlug('header')
console.log(data.name) // "Header"
console.log(data.data) // Resolved content (links, logo, menu items, etc.)global
global(slug: string, options?: BaseRequestOptions): Promise<GlobalBlockResponse>Retrieves a single global block by slug.
Parameter | Type | Description |
|---|---|---|
|
| The block slug |
|
| Request options |
Returns: Promise<GlobalBlockResponse>
// Deprecated -- use getBySlug() instead:
const { data } = await lynkow.globals.getBySlug('footer')siteConfig
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 |
|---|---|---|
|
| Request options; use |
Returns: Promise<SiteConfigResponse>
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