Contents

Modules

The content modules are switched on and off in src/modules.config.ts. Every module is on as shipped:

export const modules = {
  news: true,
  jobs: true,
  dealers: true,
  cases: true,
  catalog: true,
} satisfies ModuleSwitches
ModuleWhat it holdsIts address
newsArticles and their authors/news, with an RSS feed and a page per topic
jobsJob ads, departments and employment types/jobs
dealersDealers and dealer types, in a list and on a map/dealers
casesCase studies/cases, with an RSS feed and a page per topic
catalogProducts and product families, attributes, features and certifications, each with their categories/products

Pages, reusable sections, media, the icon and pictogram libraries, forms, the editors' guides and the translation tools are always there. Topics, the shared tags, stay while news, case studies or the catalog is on.

Set a module to false, then restart the development server, or build again for production. On PostgreSQL, also create a migration (see below).

What switching off does #

  • It is gone from the site and the admin. Its collections leave the admin and the API. Its addresses answer 404, and pages may take them. Links, cards, the sitemap and "Index page for" no longer offer it, and its blocks leave the block picker. Its settings (Site settings → Catalog, Site settings → Maps) and its interface texts in Microcopy are hidden.
  • On MongoDB its data stays. Its documents stay in the database, untouched. Switch the module back on and everything is there again, settings included.
  • On PostgreSQL it is a migration that deletes its data. The module's tables go, with their documents. Export what you want to keep first. See Switching a module off.
  • Pages that used it keep working. A page can still hold one of its blocks, or link to one of its documents. The site and the admin leave those parts out when they read the page. The database keeps them until the page is saved; saving removes them, in every language.
  • Nothing to regenerate. pnpm generate:types and pnpm generate:importmap always cover every module, so the code type-checks and the admin finds every component whichever modules are on.
  • Tests follow the switches. The unit, integration and end-to-end tests skip a switched-off module's tests and seed only what the modules that are on need. So does pnpm seed:demo.

In code #

Ask whether something is on with the helpers in src/registry/modules.ts: moduleEnabled(id), enabledModules(), collectionEnabled(slug) and blockEnabled(slug). Never with an environment variable: the browser bundle would not see it.

To write a module of your own, see Add a module.

These guides ship with Tolk Starter 0.6.0: buyers get the same pages in their repository, next to the code they describe.