Custom Site Template Development for 1C-Bitrix
Off-the-shelf templates from the Bitrix Marketplace solve 20% of real-world needs. The remaining 80% require custom work: a unique design, non-standard page structure, specific performance requirements, or integration with external systems. Building a template "on top of" a marketplace theme leads to technical debt: third-party styles and scripts conflict, and template updates overwrite customizations.
Custom Site Template Development for 1C-Bitrix
Custom Template Structure
A custom template is created in /local/templates/<template_name>/. Using /local/ is essential: this directory is not touched by Bitrix updates. Minimum structure:
/local/templates/main/
header.php — site header, CSS/JS inclusion
footer.php — footer, closing tags
styles.css — main styles (or build output inclusion)
script.js — main scripts
.parameters.php — template settings (optional)
components/ — component template overrides
page_templates/ — page type templates
images/ — template images
In header.php, resources are connected via $APPLICATION->SetAdditionalCSS() and $APPLICATION->AddHeadScript(). For modern projects it is more convenient to use a bundler (Webpack, Vite) with output targeting the template folder.
Resource Inclusion and Asset Pipeline
Bitrix supports two approaches:
Native — CUtil::InitJSCore(), $APPLICATION->SetAdditionalCSS('/local/templates/main/css/style.css'), Asset::getInstance()->addJs(). Files are served directly; concatenation is available via the main module settings.
Via bundler — npm run build generates minified bundles in /local/templates/main/assets/. The output file is connected in header.php. This approach is preferred: tree-shaking, PostCSS, modern JS with transpilation.
For projects with a Vue or React frontend, the Bitrix template acts as a shell: it renders HTML containers and passes data via <script> tags with JSON assembled from component $arResult values.
Page Types and page_templates
The page_templates/ directory holds PHP files with different page layouts. For example: layout-fullwidth.php (no sidebar), layout-sidebar.php (with a side column), layout-landing.php (no header or footer for landing pages). Editors select the page type in the admin panel.
This allows a single site template to cover different page structures without duplicating code.
Case Study: Template for a B2B Portal
A manufacturing company on Bitrix "Business". Requirements: a dealer personal account with individual pricing, a catalog without public access, integration with 1C via API. A standard template did not fit — custom navigation based on user groups was required.
We developed the template from scratch in /local/templates/b2b/. In header.php — authorization check via $USER->IsAuthorized(), with a redirect to the login page for unauthorized users. Navigation is built dynamically via bitrix:menu with a custom template that shows menu items based on the user's group. Styles — Tailwind CSS via PostCSS, Vite build. Result: a template built from scratch in 3 weeks, including templates for the main catalog and personal account components.
Things to Consider During Development
-
Edit mode — when the Bitrix admin toolbar is enabled, it adds overlays for content editing. The template must work correctly with
bx-editmode-overlayclasses -
SEO meta —
$APPLICATION->SetTitle(),$APPLICATION->SetKeywords(),$APPLICATION->SetDescription()are called by components; the template must output them in<head>via the corresponding methods -
Caching —
managed_cacheandCPHPCachecache component output, but notheader.php/footer.php— these are rendered on every request - Security — the template must not contain direct SQL queries; all data must go through the Bitrix API
Timeline
| Template scope | Timeline |
|---|---|
| Simple template (up to 5 page types, basic components) | 2–4 weeks |
| Medium template (5–15 page types, custom components) | 4–8 weeks |
| Complex template (B2B, personal account, non-standard logic) | 8–16 weeks |







