Back to Help

Build a site with a custom layout over MCP

November 24, 2026

An end-to-end example of a custom layout with shared partials, CSS, JavaScript and JSON from storage, plus the rules for assets, storage, caching, the site password and JavaScript.


1. Before you start

You need:

  • An OmniCon channel you are a member of, and its channel ID (list_channels).
  • The OmniCon MCP server connected to your agent.
  • The channel set to public if anonymous visitors should see it.

How the pieces fit:

PieceWhat it isMCP tools
LayoutA complete HTML document written in Handlebars. It replaces the built-in page.create_channel_layout, update_channel_layout, get_channel_layout
PartialA reusable fragment a layout includes with {{> id}}.create_channel_partial, update_channel_partial, get_channel_partials
Channel assetA registered CSS or JavaScript file for the channel.create_channel_asset, update_channel_asset, list_channel_assets
Storage fileAny uploaded file (image, JSON, PDF…), reachable at a public URL.upload_inline, upload_from_url, upload_file, get_file_url
BindingsWhich layout the channel home and article pages use, and the on/off switch.update_channel_layout_bindings

Three rules that prevent most of the trial and error:

  1. Nothing is added to a custom layout for you. The layout is the whole page. Theme colours, registered CSS and registered JavaScript appear only where the layout places their tokens (section 3).
  2. Create partials before the layout that uses them. A {{> id}} that names a partial which does not exist makes the page fall back to the built-in view.
  3. A saved change is stored at once but public pages are cached. Allow up to 10 minutes before an anonymous visitor sees it (section 7). The response to every create or update returns the stored source, so you can confirm the save without looking at the page.

A failed call comes back with isError: true and a JSON body { "error": { "code", "message", "requestId" } }. Quote the requestId when contacting support.

2. Walkthrough: one small site, start to finish

The site: a home page listing articles, a shared header and footer, one stylesheet, one script, and a JSON data file the script loads.

Step 1 — partials

create_channel_partial with id: "site-header":

<header class="site-header">
  <a href="/{{site.cultureCode}}/c/{{channel.slug}}">{{channel.name}}</a>
  {{#if channel.tagline}}<p>{{channel.tagline}}</p>{{/if}}
</header>

create_channel_partial with id: "site-footer":

<footer class="site-footer">© {{site.currentYear}} {{channel.name}}</footer>

Correct result: each response contains partial.id and the source you sent. The id is what you write after {{>.

Step 2 — the stylesheet and the script, as channel assets

create_channel_asset with name: "site.css", kind: "css", content:

body { margin: 0; font-family: var(--brand-font-body); color: var(--brand-text); }
.site-header, .site-footer { padding: 1rem; background: var(--brand-surface); }
.trails li { margin: .5rem 0; }

Upload the data file first so the script can be given its URL (step 3), then create_channel_asset with name: "trails.js", kind: "js", loadLocation: "BodyEnd", content:

(async () => {
  const list = document.querySelector('[data-trails]');
  if (!list) return;
  const response = await fetch(list.dataset.trails);
  if (!response.ok) return;
  for (const trail of await response.json()) {
    const item = document.createElement('li');
    item.textContent = `${trail.name} (${trail.km} km)`;
    list.appendChild(item);
  }
})();

Correct result: the response shows the asset with Version: 1 and IsEnabled: true. Inline code is limited to 32,000 characters and a channel holds at most 20 assets (section 4). A JavaScript asset has a condition (section 9).

Step 3 — the JSON data file, in storage

upload_inline with fileName: "trails.json", contentType: "application/json", space: "auto", and the file as base64:

[{ "name": "Kamikochi loop", "km": 12 }, { "name": "Mt. Yake", "km": 9 }]

Correct result: the file lands in the Documents space and the response gives its URL. Keep that URL; it goes into the layout in step 4. The URL is public (section 6), and every upload gets a new URL (section 7).

Step 4 — the layout

create_channel_layout with id: "home":

<!doctype html>
<html lang="{{site.cultureCode}}">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{channel.name}}</title>
  {{{theme.cssBlock}}}
  {{{assets.head}}}
</head>
<body>
  {{> site-header}}

  <main>
    {{#if articles}}
      <ul>
        {{#each articles}}
          <li><a href="{{url}}">{{title}}</a></li>
        {{/each}}
      </ul>
    {{/if}}

    <ul class="trails" data-trails="PASTE-THE-JSON-URL-FROM-STEP-3"></ul>
  </main>

  {{> site-footer}}
  {{{assets.bodyEnd}}}
</body>
</html>

Correct result: the response contains layout.id: "home" and the stored source. An unclosed block or other syntax error is refused with code invalid_template and nothing is saved.

Step 5 — switch it on

update_channel_layout_bindings with enabled: true and defaultIndexLayoutId: "home". This call replaces all bindings, so pass every value you want kept (defaultDetailLayoutId, defaultAssetDetailLayoutId). A layout ID that does not exist is silently dropped, so read the response: it shows the bindings that were actually saved.

Step 6 — check the result

  1. get_channel_layout_bindings shows enabled: true and your layout ID.
  2. Open the channel home while signed in to OmniCon. Signed-in requests are never served from the edge cache.
  3. View source and confirm: a <link> to /assets/channel/.../….css?v=1 in the head, a <script> for the .js file before </body>, and the header and footer markup.
  4. If the page shows the built-in design instead, the layout failed to render (most often a missing partial). Open Theme in the dashboard: the error is shown there.

3. How registered channel assets get into a custom layout

  • Built-in pages load every enabled asset automatically.
  • A custom layout loads them only where it says so: {{{assets.head}}} inside <head> and {{{assets.bodyEnd}}} just before </body>. Leave them out and the page has none of the channel's CSS or JavaScript. Both are safe to include when the channel has no assets; they render as nothing.
  • CSS always goes to the head. JavaScript goes to the head or the end of the body according to the asset's load location.
  • Assets load in their load order, lowest first.
  • An asset scoped to a folder or a tag (appliesTo: "folder:news") loads only on article pages in that folder or with that tag. The channel home gets only assets scoped to all.
  • The tokens are empty on the "page not found" page and inside a partial used by a Search Results block.
  • The Theme editor's preview uses sample data and never shows assets. Check them on the real page.
  • New layouts started from a starter template include both tokens.

4. Limits on inline assets

LimitValue
Inline code in one asset32,000 characters
Assets per channel20, counting disabled ones

A larger file is refused with code content_too_large and a message that says so. For anything bigger, upload the file to storage or host it on a CDN, and register it with externalUrl instead of content.

5. Where an uploaded file lands

Storage has three spaces. The file's content type decides the space; the file extension does not.

SpaceContent typesExamples
Mediaimage/*, video/*, audio/*PNG, JPEG, SVG, MP4, MP3
DocumentsPDF, Office files, zip, text/plain, text/markdown, text/csv, XML, application/json, fontsJSON, CSV, PDF, WOFF2
Drop (shown as "Other" in the dashboard)everything elseCSS, JavaScript, HTML
  • With space: "auto" the file is routed for you. If you name a space the content type is not allowed in, the call is refused and tells you where it belongs, for example: Content type 'text/css' is not allowed in Documents. It belongs in Drop.
  • HEIC and HEIF images are refused; convert them to JPEG or PNG.
Upload methodLargest fileNotes
upload_inline5 MBBase64 in the call. Best for small text files such as JSON.
upload_from_url50 MBOmniCon fetches a public URL.
upload_file50 MBReturns an endpoint and a script to send the bytes yourself. Files sent this way keep their file name as the URL and do not appear in list_files or the dashboard until Rescan is run in Storage.

Uploads also count against the organization's storage allowance; over it, the call is refused with code quota_exceeded.

CSS and JavaScript: prefer a channel asset (section 3) to an uploaded file. An asset is versioned for you; an uploaded file is not (section 7).

6. The site password does not cover uploaded files

Turning on a channel's password puts a prompt in front of its pages: the channel home, article and page URLs, and asset detail pages.

It does not cover:

  • Files in storage. Every uploaded file has a public URL. Anyone who has the URL can open the file, password or not. Do not put anything in storage that must stay private.
  • The channel's registered CSS and JavaScript files.
  • The API and the MCP server, which have their own sign-in.

Signed-in members of the channel's organization are not asked for the password.

7. Changing a file safely, and how long changes take to show

Changing a file

What you changedWhat happensWhat to do
A channel asset (update_channel_asset, or the dashboard)Its version number goes up, which changes its URL, so browsers fetch the new code.Nothing. This is the safe way to ship CSS and JavaScript.
A file re-uploaded with upload_inline, upload_from_url or the dashboardA new file with a new URL is created. The old file and its URL stay as they were, and pages keep using the old one.Put the new URL wherever the old one was used (layout, partial, asset, article), then delete the old file once nothing uses it.
A file overwritten with upload_file (same name) or Replace in the dashboardSame URL, new contents. How soon visitors get it depends on caching you do not control. Replace also leaves an image's thumbnail and web-sized copy unchanged.Use only when the URL must not change, and expect a delay.

How long a change takes to show

ChangeSeen by a signed-in memberSeen by an anonymous visitor
Article or page contentat onceup to 5 minutes
A page that lists articles (home, search results)at onceup to 1 minute
Layout or partial edited in the dashboardat onceup to 5 minutes
Layout or partial edited over MCPat onceup to 10 minutes
Channel assetat onceup to 5 minutes

There is nothing to purge and no need to create a new layout ID. If a change is still missing after 10 minutes, check the stored source with get_channel_layout and the Theme page for a render error.

8. Why a file that is in use can say "unused"

The "used" count on a storage file records one thing: articles saved in the OmniCon editor that reference the file in their body or as their main image.

A file is not counted as used when it is referenced only by:

  • a layout or a partial,
  • a channel asset, or the theme,
  • a page,
  • an article written over MCP or the API,
  • JavaScript that fetches it (a JSON data file, for example).

So a file that the whole site depends on can show as unused, and delete_file will not warn about it. A reference is also never removed once recorded, so "used" can be out of date in the other direction.

Before deleting a file, search the channel's layouts, partials and assets for its URL. Nothing deletes unused files automatically.

9. JavaScript

The rule: custom JavaScript needs a paid plan or a verified custom domain; either one is enough. A script runs with full access to the page it is on, so it is not offered to free channels on the shared omnicon.cloud address, where channels sit side by side.

WhereWhat applies
A new JavaScript channel asset, in the dashboardFollows the rule.
A new JavaScript channel asset, over MCPFollows the rule. Refused with code javascript_not_allowed.
Editing, disabling or deleting an existing JavaScript assetAlways allowed.
CSS assetsNot restricted.
A .js file uploaded to storageAllowed (it lands in Drop). A file alone does nothing until a page loads it.