What a theme is

A theme is a folder of ordinary files: HTML pages, a stylesheet, images, fonts and, if you like, a little JavaScript. It decides how the whole public site looks: the header, the menu, the footer, the home page, and the style of every page inside them.

The words and pictures are not part of the theme. Editors write them in the admin, and the theme shows them. That split is what lets you redesign a site without touching its content, and lets editors change content without breaking your design.

You design (the theme)Editors fill in (the admin)
Header, logo, menu style, footerThe site title and tagline (Admin > Sites)
The home page layoutThe pages, their text and images (Admin > Pages)
Colours, fonts, spacing, buttons, formsWhich pages appear in the menu, and in what order
The not-found, error and maintenance pagesWidgets, collections and products placed in pages

You need a code editor (for example VS Code), basic HTML and CSS, and somewhere to try the theme: a copy of the site on your own computer, set up once by a developer, or a test server. See Testing your theme.

The quickest start: change the colours

Every Carnival3 site comes with the starter theme: clean, neutral and already responsive (it has a phone menu, and its columns stack on small screens). The quickest new theme reuses all of it and changes only the colours, fonts and corners. The built-in dark-slate theme was made exactly this way.

Copy three things from themes/starter/ and write one stylesheet:

themes/sunset/
├── layout.html        copied from starter, unchanged
├── js/main.js         copied from starter (the phone menu)
├── images/favicon.svg copied from starter (replace it with your own icon later)
└── css/style.css      your colours

The copied layout loads the stylesheet, script and icon from your theme's own folder, which is why those files must be there. Then start css/style.css like this:

/* Everything from starter, then my changes */
@import url('/themes/starter/css/style.css');

:root {
  --primary: #e8590c;        /* buttons, links, active menu item */
  --primary-hover: #d9480f;
  --primary-light: #fff4e6;  /* soft backgrounds behind tags */
  --primary-border: #ffd8a8;
  --bg-main: #fffaf5;        /* page background */
  --bg-surface: #ffffff;     /* cards, header */
  --text-main: #2b1d12;      /* body text */
  --text-muted: #7c6a5c;     /* secondary text */
  --radius-md: 4px;          /* squarer corners */
}

That is a complete theme. Pages you did not copy (home, not-found, error, maintenance) are taken from starter automatically.

The colour and shape settings

SettingWhat it changes
--primary, --primary-hoverThe main brand colour: buttons, links, the active menu item; and its hover shade
--primary-light, --primary-borderPale versions of the brand colour, for tags and highlighted boxes
--bg-main, --bg-surface, --bg-muted, --bg-subtlePage background; cards and header; quiet panels; dividers and stripes
--text-main, --text-muted, --text-subtleBody text; secondary text; the faintest text (hints, dates)
--border-color, --border-focusLines around cards and fields; the outline of a field being typed in
--font-sans, --font-displayThe body font; the headings font
--radius-sm, --radius-md, --radius-lgCorner rounding, small to large
--shadow-sm, --shadow-md, --shadow-lgShadows under cards and pop-ups

For a dark theme, set the backgrounds dark and the text light; themes/dark-slate/css/style.css is a full example to copy from.

A theme of your own

When you want a different layout, not only different colours, build the pages yourself. Starting from a full copy of themes/starter/ is still the easiest way: you begin with something that works and change it step by step.

themes/sunset/
├── layout.html        required: the frame of every page (header, menu, footer)
├── home.html          the home page (address: /)
├── pricing.html       any extra page: pricing.html is shown at /pricing
├── 404.html           "page not found"
├── 500.html           "something went wrong"
├── maintenance.html   shown to visitors while the site is in maintenance
├── collections/       optional: your own look for collection pages
├── css/style.css      your styles
├── js/main.js         optional: your scripts
├── images/            logo, favicon, backgrounds
├── fonts/             optional: font files you host yourself
└── theme.json         optional: the theme's display name and description
  • Only layout.html is required. Every page you leave out is taken from the starter theme.
  • Each .html file is a page of the site: home.html is the home page, and any other file is shown at its own name, so pricing.html becomes /pricing. No setup is needed.
  • Name files and folders in lowercase letters, digits and dashes: our-team.html, not Our Team.html. The folder name (sunset) is the theme's name for good.
  • The theme folder name is also how you address its files: /themes/sunset/css/style.css, /themes/sunset/images/logo.svg.

Optional theme.json, shown in Admin > Themes:

{ "name": "Sunset", "description": "Warm colours, large photos, for restaurants and cafes." }

The layout: the frame of every page

layout.html is a complete HTML page with a hole in the middle where each page goes. Here is a short one with everything that matters:

<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><!-- @title --></title>
  <meta name="description" content="{{ site.description }}">
  <link rel="icon" href="/themes/{{ siteTheme }}/images/favicon.svg">
  <link rel="stylesheet" href="/themes/{{ siteTheme }}/css/style.css">
  <script>window.__CSRF_TOKEN__ = "";</script>
  <!-- @head -->
  <!-- @styles -->
</head>
<body class="theme-sunset">
  <header>
    <a href="/" class="logo">{{ site.title }}</a>
    <nav>
      {{#each siteNavItems}}
        <a href="{{ path }}" class="{{#if isActive}}active{{/if}}">{{ label }}</a>
      {{/each}}
    </nav>
  </header>

  <main>
    <!-- @content -->
  </main>

  <footer>
    {{ site.tagline }} · &copy; {{ site.year }} {{ site.title }}
  </footer>

  <script src="/themes/{{ siteTheme }}/js/main.js"></script>
  <!-- @scripts -->
</body>
</html>

Keep these lines

The comments that look like <!-- @content --> are not notes: they are the places where Carnival3 puts things. Keep all of them, where they are.

LineWhy it is needed
<!-- @content -->Where each page appears. Without it, every page is empty.
<!-- @title -->The page title in the browser tab and in search results.
<!-- @head -->Search engine and social media tags, and analytics, from Settings > SEO.
<!-- @styles -->, <!-- @scripts -->The styles and scripts of widgets on the page. The contact form does not send without them.
The viewport meta lineWithout it, phones show the desktop design shrunk to fit.
The __CSRF_TOKEN__ scriptA security code that forms (contact form, sign-in) send back with each message.

Put things that every page shares in the layout: header, menu, footer, fonts, the stylesheet. The other files hold only what goes in the middle.

Template tags: showing content

Wherever the site's content should appear, write a tag in double curly braces. Carnival3 replaces it with the real text when the page is shown.

WriteTo show
{{ site.title }}The site's name (Admin > Sites)
{{ site.tagline }}Its short tagline, for the hero or the footer (empty when there is none)
{{ site.year }}This year, for the copyright line
{{ site.description }}The page's description for search engines (only for the meta tag)
{{ siteTheme }}Your theme's folder name, for file addresses: /themes/{{ siteTheme }}/images/logo.svg
{{ currentSite.contact_email }}The site's contact email
{{ user.name }}The name of a signed-in visitor

Show something only sometimes

{{#if site.tagline}}
  <p class="tagline">{{ site.tagline }}</p>
{{/if}}

{{#if isLoggedIn}}
  <a href="/users/profile">Hello, {{ user.name }}</a>
{{else}}
  <a href="/users/login">Sign in</a>
{{/if}}

Repeat something for every item

{{#each}} repeats its inside once per item, as in the menu above. Inside it, write the item's own details by name ({{ label }}, {{ path }}).

Good to know

  • Two braces show text safely: any HTML in it appears as written. Three braces, {{{ content }}}, show a page's formatted text (headings, bold, images). Use three only where this guide does.
  • Double curly braces are always read as a tag, so do not use them as decoration in your text.
  • A tag with a typo shows nothing; it does not break the page. If something is missing, check the spelling.

The menu

siteNavItems holds the menu links, in order: Home, links from switched-on features (for example Products), then every page an editor ticked "Show in navigation" in Admin > Pages. Each link has a label, a path and isActive (true on the page being viewed, for highlighting). You decide only how the menu looks; editors decide what is in it.

Design for a menu that grows: five links today can be nine next month. Starter shows how to fold the menu behind a Menu button on phones (the nav-toggle button in its layout, and js/main.js). You can reuse both.

The home page

home.html is shown at the site's address. It usually opens with a large hero, the site's title and tagline:

<section class="hero">
  <h1>{{ site.title }}</h1>
  {{#if site.tagline}}<p>{{ site.tagline }}</p>{{/if}}
</section>

Home page sections

Editors can mark pages as a "Section of the home page" (Admin > Pages > Display). Those pages then appear one after another on the home page instead of on pages of their own, and their menu links scroll down to them. Your home.html decides where and how they appear:

{{#each homeSections}}
  <section id="{{ slug }}" class="home-section">
    <h2>{{ title }}</h2>
    {{#if description}}<p class="lead">{{ description }}</p>{{/if}}
    <div class="article-body">{{{ content }}}</div>
  </section>
{{/each}}
  • Keep id="{{ slug }}": the menu links jump to it.
  • Each section has a title, a description (the page's summary, good as a subtitle) and its content.
  • Alternate backgrounds with .home-section:nth-child(even) to set sections apart.
  • A home page without this block shows no sections, and the Pages editor warns editors that the theme does not show them.

The built-in hero theme is a complete example of a hero home page: a full-width banner picture (object-fit: cover, so any photo fills it), a title card overlapping its bottom edge, then the sections; until there are sections it shows placeholder cards and text, so a fresh site never looks empty. Its images/hero.svg and images/placeholder.svg are placeholders to replace with real pictures.

The built-in c3 theme shows the other approach to a fresh site: its home.html carries finished bands (features, two cards, a picture beside a list) inside {{#unless homeSections}}, so the home page looks complete at once, and editors take over by adding sections. It also hosts its own font: fonts/Fiesta.ttf, declared with @font-face in its stylesheet.

The built-in one-page theme is a complete example of a site built from sections: numbered sections, title on the left, content on the right, and a menu that follows the section being read.

Extra pages

Any other .html file is a page at its own address: pricing.html is /pricing, our-story.html is /our-story. Write only the middle part; the layout adds the header and footer:

<section class="section">
  <div class="container">
    <h1 class="page-title">Pricing</h1>
    <p>Three plans, no surprises.</p>
  </div>
</section>

Text you write in a theme page can be changed only by editing the file. For text that editors should keep up to date, leave the page to them in Admin > Pages, or place editable blocks in your page:

WriteTo place
{{ page='opening-hours' }}The text of a page from Admin > Pages (here the one at /opening-hours)
{{ widgets:render type="card" instance_name="spring-offer" }}A widget made in Admin > Widgets
{{ collections:render collection="testimonials" limit="3" }}The latest items of a collection (Admin > Collections)

The admin shows these codes ready to copy: the Embed Code column in Admin > Widgets and Admin > Collections. Ask the editors for the names they use. A file with the same name as an editor's page wins (your about.html hides the editors' About page), so agree on names first.

Pages you style but do not write

Some pages come with their own HTML, and your theme shows them inside its layout: pages from Admin > Pages, products, collections, the visitor sign-in pages and the contact form. You style them with CSS. These are the class names to know:

WhereMain classes
Everywhere (shared building blocks)section, container, container-narrow, page-header, page-title, section-desc, card, tag, btn, btn-primary, btn-outline, btn-sm, btn-lg, alert, alert-success, alert-error, grid, grid-3
Pages from Admin > Pagesarticle-body holds the editor's text, and nothing else. It sits in the page's container, so it starts at the same left edge as the header and footer, and is at most 960px wide (starter's rules; home page sections the same): the page's title is not printed, so the content starts with its own h1. Images that text wraps around carry the classes img-left, img-right or img-center (on the image, or on its figure class="image" with a figcaption). Built-in themes style them through the starter theme; an uploaded theme that does not import /themes/starter/css/style.css adds @import url('/themes/starter/css/content-images.css'); at the top of its CSS, or styles the classes itself (float with a margin, a max-width, no float on phones). The Pages editor shows the content with your styles too (it loads the stylesheets your layout.html links and its <body> classes, with the editing area as .article-body), so editors see the page as visitors will; keep the content's styles under .article-body and on body (fonts, colours), not on wrappers only the site has. Style its h1, h2, h3, p, ul, img, blockquote, table and links. This one matters most.
Products (/products)product-card, product-image, product-title, product-price, product-desc, product-category-badge, catalog-pager; product page: product-detail-layout, product-detail-image, product-detail-info, product-detail-price, stock-status
Collections (/c/...)coll-grid, coll-card, coll-title, coll-field, coll-label, coll-pages; item page: coll-details, coll-back; inside pages: coll-embed, coll-embed-item
Sign-in, register, password and profile pagesAll inside account-page; forms use form-group, form-label, form-control
Contact formcfw-form, cfw-field, cfw-label, cfw-button, cfw-status (with cfw-ok / cfw-error after sending)

A copy of starter's css/style.css already styles all the shared building blocks, so these pages look right from the start.

When your style does not apply

Collections, the contact form and other widgets bring a few neutral styles of their own, which load after your stylesheet and win a tie. Give the <body> in your layout a class named after your theme and start those rules with it:

/* layout.html: <body class="theme-sunset"> */
.theme-sunset .cfw-button { background: var(--primary); border-radius: 999px; }
.theme-sunset .coll-card  { border: none; box-shadow: var(--shadow-md); }

The sign-in pages do the opposite: their built-in styles give way to any rule of yours, so plain class names are enough there.

Your own collection pages

For full control over how collections look, copy their HTML files into your theme and change them freely:

themes/sunset/collections/list.html                 the list of items, every collection
themes/sunset/collections/details.html              one item
themes/sunset/collections/embed.html                items placed inside a page
themes/sunset/collections/testimonials/embed.html   only for the "testimonials" collection

The originals are in modules/collections/templates/. How to create a collection lists the details each one receives.

Not found, error and maintenance pages

  • 404.html appears for an address that does not exist. Keep it friendly, with a way back home.
  • 500.html appears when something breaks. Keep it plain: it must not depend on content that could be the cause.
  • maintenance.html appears to visitors while the site is in maintenance (signed-in staff still see the site). It can show the message and return time from Settings > Maintenance:
<h1>Back soon</h1>
<p>{{#if maintenanceMessage}}{{ maintenanceMessage }}{{else}}We are making some improvements.{{/if}}</p>
{{#if maintenanceUntil}}<p>Expected back: {{ maintenanceUntil }}</p>{{/if}}

Leave any of the three out and the starter theme's version is used.

Images, fonts and scripts

  • Theme images (logo, backgrounds, icons) go in images/. In CSS: url('../images/hero.jpg'). In HTML: /themes/{{ siteTheme }}/images/logo.svg.
  • Photos in the content are not theme files: editors upload them in Admin > Media. Design for photos of any shape and size, for example with object-fit: cover on fixed-height boxes.
  • The browser tab icon: images/favicon.svg (or .png / .ico), linked in the layout as shown above.
  • Fonts: link Google Fonts in the layout's <head>, or put font files in fonts/ and declare them in your CSS with @font-face and url('../fonts/...'). Check each font's licence: many free fonts are for personal use only.
  • Scripts go in js/ and are linked at the end of the layout. Keep them small; the site works without them, and visitors see pages first.
  • Keep images light: export photos at the size they are shown (WebP or JPEG), and use SVG for logos and icons.

Design checklist

  • Phones first: check every page at phone width (about 375 pixels), tablet and desktop. Nothing should scroll sideways.
  • Long and short content: a site title of three words or of one; a menu of two links or of nine; a page with one paragraph or twenty.
  • Editor content: headings, lists, quotes, tables, images and embedded videos inside article-body all look right.
  • Contrast: text is easy to read against its background, also the muted text and text on buttons.
  • Keyboard: links and buttons show a visible outline when reached with the Tab key.
  • Every kind of page: home, a page, a home section, products, a collection, sign in, not found, maintenance, and the contact form after sending.

Testing your theme

A theme becomes visible to everyone only when a site uses it, so try it out away from the live site first.

  • On your own computer (best): ask a developer to set up a copy of the site once. Put your theme folder in themes/, choose it for the site in Admin > Sites, and refresh the browser to see each change at once.
  • On a test server: upload the theme there as a ZIP (see below) and choose it for the test site.
  • On the live site, privately: an administrator can add the theme (or a copy of one) in Admin > Themes, edit it and click Preview. The public site then shows in that theme for that administrator only, with a bar at the bottom to stop the preview; visitors keep seeing the real theme. See Editing a theme in the admin.

If a change does not show up:

  • The page itself: visitors who are not signed in may see a saved copy for a few minutes. Signed-in users always see the latest version; to refresh it for everyone, use Purge Entire Cache in Admin > System > Cache.
  • Your CSS or JavaScript: files of an uploaded theme are checked with the server on every visit, so a change shows at once. Built-in themes' files are kept by browsers for up to a day. Force a reload (Ctrl+F5, or Cmd+Shift+R on a Mac). Before handing over a new version, add a version number to the links in the layout, style.css?v=2, so visitors get the new file at once.

Packaging and uploading

Themes are added in Admin > Themes by administrators and managers.

  1. Zip the theme folder. Name the ZIP after the theme: sunset.zip becomes the theme sunset. The name cannot be changed later.
  2. Check what is inside: layout.html at the top (one folder around everything is fine), and only page, style, script, image, font and video files, such as .html, .css, .js, .json, .txt, .md, .png, .jpg, .svg, .webp, .avif, .gif, .ico, .woff2, .woff, .ttf, .otf, .mp4, .webm and .mp3. Anything else is refused, so remove design files (.psd, .fig, .sketch) and system files such as .DS_Store.
  3. Add Theme: choose the ZIP, a display name and a description (or leave them empty to use theme.json), and whether the theme is enabled. A theme whose name already exists is never overwritten.
  4. Edit the theme and set its Layout: pick the arrangement your design is built around (one column, sidebar left, cards grid, landing page, ...) from the pictures. It shows in the themes list and helps people choose a theme.
  5. In Admin > Sites, edit the site and choose the theme. Only enabled themes are offered.

Updating an uploaded theme

Edit the theme in Admin > Themes and use Upload new version. The files in the new ZIP replace the files with the same name, new files are added, and files the ZIP does not contain stay as they are. A ZIP with only css/style.css is enough for a colour change. Built-in themes (starter, dark-slate, one-page, hero, c3) cannot be replaced this way: Duplicate one instead (below).

Where uploaded themes are kept

Uploaded themes are stored apart from the code, in the uploaded-themes/ folder (on Render, on the persistent disk with the uploads), so updates of the site do not remove them. Include that folder in your backups. Built-in themes live in themes/ with the code. To make an uploaded theme part of the code, use Download ZIP and give it to the developer, who adds the folder to themes/; from then on it is a built-in theme.

Editing a theme in the admin

Edit a theme in Admin > Themes (the pencil): the Files section has these buttons.

  • Duplicate (anyone who may add themes): copies any theme, built-in ones too, as a new uploaded theme with its own folder name and display name. Change the copy freely; the original stays as it is. This is the way to start from starter, hero or another built-in theme.
  • Download ZIP: the theme's files as a ZIP with one folder, the same shape Add Theme takes. Use it as a backup, to move a theme to another server, or to hand a theme to the developer.
  • Edit files (administrators, uploaded themes): opens the theme's files in a code editor (also the file icon in the list).
  • Preview (administrators): shows the public site in this theme, to you only. Previewing another theme replaces it. The preview ends when you click Stop preview in the bar at the bottom of the page, use View Site (admin header, Dashboard, Sites list: always the site's real theme), or close the browser. Statistics do not count these views.

The file editor

  • The list on the left holds every file of the theme. Text files (.html, .css, .js, .json, .txt, .md, .svg) open in the editor with colours for the code, matching brackets and closing tags. Other files (images, fonts) are shown, and replaced by uploading a file with the same path.
  • Save (or Ctrl+S, Cmd+S on a Mac) writes the file; the site shows the change at once.
  • Earlier versions: every save keeps the previous content (the last 20 per file). Choose one in the list above the editor to load it; save to restore it.
  • Checks: layout.html cannot be saved without its five slots or the viewport line, and cannot be deleted. Paths use letters, digits, dots, dashes and underscores, at most three folders deep, with the same file types as a theme ZIP. Text files are at most 1 MB.
  • New file (the page icon) creates an empty text file, folders included (css/extra.css); a new <page>.html becomes the page /<page>. Upload (the arrow icon) adds or replaces any allowed file, such as an image or a font.
  • Every save, upload and delete is recorded in the Audit Log.
  • Built-in themes cannot be edited here: they belong to the code. Duplicate one and edit the copy.

Only administrators may edit files: a theme's JavaScript runs for everyone who opens the site, administrators included, so editing a theme is as powerful as having admin rights.

Before you hand it over

  • layout.html keeps the viewport line, the __CSRF_TOKEN__ script and all five slots (@title, @head, @styles, @content, @scripts).
  • The menu uses siteNavItems; the title and tagline use site.title and site.tagline, not typed-in text.
  • File names are lowercase with dashes; the ZIP is named after the theme and holds only allowed file types.
  • Every page in the design checklist was tried at phone and desktop width.
  • Fonts and images may be used on a website (licences checked).
  • theme.json has a clear name and a one-line description for the people choosing a theme.

Related guides: How to create a site (the developer's side of themes and sites), How to create a widget and How to create a collection.