Skip to content

TypeScript API / @laikacms/astro/loader / entryIdOf

Function: entryIdOf() ​

ts
function entryIdOf(
   key, 
   collection, 
   entry
): string;

Derive an Astro entry id from a Laika key.

The default strips the collection prefix and keeps everything after it, slashes included: posts/2026/hello in collection posts becomes 2026/hello. That keeps the mapping round-trippable — key is always ${collection}/${id} — which is what lets the live loader accept an id and the build loader accept a key without either needing a lookup table.

Parameters ​

ParameterType
keystring
collectionstring
entryEntryOptions

Returns ​

string

Released under the MIT License.