BigCommerce Troubleshooting

A custom Stencil web-page template does not appear

A custom Stencil web page template is ignored: fix the custom folder and customLayouts mapping, restart Stencil, then upload the theme and select it under Template Layout File.

Last updated · Domains, themes and storefronts · Applies to: Stencil themes and Stencil CLI, local development and live storefronts

Symptoms

  • You created a custom template for a web page (for example about-us.html), but the page still renders with the theme's default page layout.
  • During local development, stencil start runs without errors, yet the mapped URL on your local port (for example localhost:3000/about-us/) shows the normal page.
  • On the live store, the custom template is missing from the page's Template Layout File dropdown, or it is listed but the page still looks unchanged.
  • On a store with more than one storefront channel, the template shows on one channel but not another.

There is usually no error message. The page simply falls back to the default template.

Cause

Stencil handles custom templates in two separate ways, and each fails differently. The most common causes, most likely first:

  1. Local mapping problem. The Stencil CLI cannot tell what kind of page a local template is for. It uses the customLayouts mapping in config.stencil.json (older CLI versions used a .stencil file) to match the template to an existing store URL. A wrong key, a URL that is not a real page, a misnamed file, or a file in the wrong folder means the default template is used.
  2. The template was never assigned live. Mapping a template to a URL is only for local testing. On the live store the theme has to be bundled and uploaded, and then someone has to assign the template to the page in the control panel.
  3. The theme in use does not contain the template. If the template was added after the last upload, or a different theme or variation is active, the dropdown will not list it.
  4. A stale local process. In one public report of this problem, the developer said a full system reboot cleared it. The root cause was never established.

Resolution

Work through these steps in order. The early ones are safe and change nothing on the live store.

  1. Check the folder and file name. Web page templates must be in templates/pages/custom/page/. Brand, category and product templates go in the matching brand, category and product subfolders. BigCommerce's docs say to set 755 permissions on new folders and 644 on new files; without them, bundling fails and the theme cannot be uploaded.
  2. Check the local mapping. In config.stencil.json, under customLayouts, the page key should map the file name to a real web page URL, such as "about-us.html": "/about-us/". The URL must point to a page that is already configured in the store; a placeholder will not work. Trailing slashes are optional. URL-encode any special characters.
  3. Restart Stencil. Stop the CLI and run stencil start again. BigCommerce's docs say you must restart Stencil to see mapping changes locally. If the page still shows the default layout and you are sure the mapping is right, close any other running Stencil processes or reboot, which cleared the issue in the reported case.
  4. Update the CLI if it is old. Reinstall it globally with npm as the BigCommerce docs describe. Releases before Stencil V3.1 read the mapping from a .stencil file rather than config.stencil.json, so an old CLI can ignore a correct mapping.
  5. Bundle and upload the theme. Use stencil push, which bundles the theme and uploads it to the store in one step. It only works for a theme initialized with a Stencil CLI token that has the Themes: modify scope. Make sure the uploaded theme is the one applied to the storefront.
  6. Assign the template in the control panel. Edit the web page and, under Advanced Options, choose your file in the Template Layout File setting, then save. If the file is not in the list, the active theme does not contain it; go back to step 5.
  7. Verify the fix. Load the page in a private browser window, view the source, and look for a distinctive element you placed only in the custom template, such as a unique heading or class name.

If none of this works, contact BigCommerce support with the theme name and version, the template file path, the page URL, your Stencil CLI version, and whether the problem is local, live or both.

B2B and multi-storefront notes

BigCommerce's Custom Template Associations API links a theme's custom templates to products, categories, brands and pages. Each record is keyed by channel ID, entity ID and type, and BigCommerce documents it as the way to apply templates on non-default channels. If you run a B2B or regional storefront, check the assignment on that channel rather than assuming it matches your default storefront.

Associations are tied to the entity ID. If an ERP connector or integration script deletes and recreates web pages, the new pages have new IDs and no custom template. Check assignments after a sync, or have the integration set them through the API. The page URL in your local mapping also needs to stay stable, so a connector that renames pages can quietly break local testing.

How to prevent it

  • Keep customLayouts in source control and update it whenever you add a template.
  • Use one distinctive marker in each custom template so you can confirm at a glance which template rendered.
  • After every theme upload, recheck the pages that use custom templates before you call the release done.
  • Read the official custom templates guide when upgrading the CLI, because config file names and behavior have changed over time.

Sources

More in the BigCommerce knowledge base, including every article on Domains, themes and storefronts.