Skip to main content
Cactal’s singleton source files apply behavior across a website. Use not_found for unmatched paths and the four custom HTML slots for third-party tags that must appear at an exact document position.

Site-wide settings at a glance

Source-backed settings follow head and published versions. Current-resource settings such as the favicon apply immediately and are not restored by source rollback.

Create a custom not-found page

The not_found singleton is a page module with the reserved route literal not_found:
not_found
The file identity is { "type": "not_found" }; it has no name. The special route is not a public URL pattern and must be exactly not_found, without a leading slash. When no page or redirect matches, Cactal renders this page with the originally requested path, the request’s query map, and an empty route-parameter map. The HTTP response remains 404, so crawlers and clients receive the correct status. Without a not_found file, Cactal returns its standard platform 404 response.

Use CMS data on the 404 page

The not-found page supports the same queries, metadata, and render props as other pages. For example, it can retrieve published navigation links:
not_found
Only published CMS items are available, including on the draft host. A failing CMS query can prevent the 404 page from rendering, so keep its dependencies small and resilient.
A get query that finds no published item on a regular page falls through to not_found with HTTP 404, so a deleted or unpublished item serves this page instead of an error.

Add custom document HTML

Four singleton types insert raw HTML into every server-rendered page: The effective document order is:

Add a head integration

Set custom head HTML

Add a tag-manager fallback

Set custom body-start HTML
Delete a slot with DELETE /v1/websiteSourceCode/files and the same { websiteId, file, leaseToken } shape.

Raw HTML and security

Custom slot content is inserted without escaping, sanitization, templating, or React processing. It can run scripts, load remote resources, modify the DOM, collect visitor data, or break page markup.
Treat custom HTML as privileged executable code. Paste only code you trust, review every remote hostname, and remove integrations you no longer use. Anyone who can edit full website source can change these slots.
Additional rules:
  • Slots apply to every rendered page, including the custom 404 page.
  • Slots cannot vary by route or use CMS/request template values.
  • Prefer the structured metadata configuration for title, description, robots, canonical, Open Graph, Twitter, alternate links, and JSON-LD. Hand-authored duplicates can produce conflicting tags.
  • Use defer, async, or module scripts when appropriate so a third-party script does not block document parsing.
  • A syntactically valid source write can still contain broken HTML. Inspect the draft’s rendered document before publishing.
  • Third-party integrations may have consent, privacy, and data-processing requirements outside Cactal.

Site favicon

Favicons are a current website setting, not a source file. Set a ready PNG, SVG, or ICO asset with PUT /v1/websites/{websiteId}/favicon:
The favicon changes immediately on published and draft hosts without a lease or publish. Served pages carry <link rel="icon"> tags for it: a PNG is linked once and doubles as the Apple touch icon, an ICO is linked as is, and an SVG is linked after its rasterized PNG preview so browsers that ignore SVG icons still show one. /favicon.ico redirects to the asset for clients that never read the tags. Send { "assetId": null } to restore the Cactal fallback. A page or redirect explicitly handling /favicon.ico wins over the setting. The dashboard offers the same choice under the site’s Settings. See Upload assets for allowed formats and upload steps.

Validate and publish

For not_found and custom HTML changes:
  1. Read the current head snapshot.
  2. Acquire an edit lease and upsert the singleton.
  3. Wait for the draft preview to become ready.
  4. Inspect a normal page and an unmatched URL on the draft host.
  5. Run POST /v1/websiteSourceCode/head/check.
  6. Publish after the draft behaves correctly.
Custom HTML is not semantically validated. The quality gate confirms source integrity and buildability, but visual and browser verification remains necessary.

Troubleshooting

Next steps