Slug configuration
Override every conventional collection and global slug through factories, with backward-compatible defaults so existing imports keep working.
Atomic Payload ships with a set of conventional collection and global slugs: pages, header, footer, designSet, shortcutSet, iconSet, forms, draftStorage, publishedStorage, and friends. None of them are hardcoded in the runtime. Every slug can be overridden through a factory, so you can rename pages to articles (or wire in your own collections) without forking the plugins.
What & why
The conventional slugs are convenient defaults, not requirements. Hooks, cache getters, revalidation handlers, admin fields, and the seed routine all read their slugs from a config object rather than a constant. That means:
- You can rename or remap any conventional slug to match your project's collections.
- The defaults stay intact. If you don't pass a slug config, everything behaves exactly as before.
- Default exports remain bound to the conventional slugs, so existing imports never break.
How it works
Each subsystem exposes a factory that takes a slug (or a slug-config object) and returns the configured artifact. The default exports are thin wrappers that call these factories with the conventional slugs.
Hooks: atomicHookWith(slugConfig)
From @pro-laico/atomic/hook. Accepts pagesSlug, designSetSlug, unsetActiveCleanup, cssProcessorSkipSlugs, cssCacheTagBySlug, and cssStorageGlobals.
import { atomicHookWith } from '@pro-laico/atomic/hook'
const hook = atomicHookWith({
pagesSlug: 'articles',
designSetSlug: 'theme',
})Revalidation: createRevalidateCache / createRevalidateCacheOnDelete
From @pro-laico/core. Each takes a per-slug handler map: createRevalidateCache(handlers) builds the beforeChange revalidation, and createRevalidateCacheOnDelete(handlers) builds the afterDelete counterpart.
import { createRevalidateCache, createRevalidateCacheOnDelete } from '@pro-laico/core'
const revalidate = createRevalidateCache({ articles: revalidateArticles })
const revalidateOnDelete = createRevalidateCacheOnDelete({ articles: revalidateArticles })Per-getter cache factories
A cached getter bound to a configurable collection ships a create* factory from the package that owns it, so you can point one at your slug. The default getter stays bound to the conventional slug.
import { createGetCachedPages } from '@pro-laico/site/cache'
import { createGetCachedBackendForms } from '@pro-laico/atomic/cache'
const getCachedArticles = createGetCachedPages('articles')
const getCachedContactForms = createGetCachedBackendForms('contactForms')Seeding: seed({ payload, req }, slugConfig)
From @pro-laico/seed. Accepts the standard { payload, req } context plus a SeedSlugConfig object so the seed data lands in your renamed collections. The slug keys are the bare collection names (pages, header, footer, forms, icon, iconSet, designSet, shortcutSet, siteMetaDataGlobal).
import { seed } from '@pro-laico/seed'
await seed({ payload, req }, { pages: 'articles' })Notes
The default exports (atomicHook, revalidateCacheCollection, TestPathField, seed, and the rest) stay bound to the atomic-payload-conventional slugs. Reach for the *With / create* factories only when you need to override a slug; otherwise the conventional defaults already do the right thing, and existing imports keep working unchanged.