Last updated

Build Fluid Themes

Build fast, flexible themes at scale using Liquid templating language, JSON sections, and modern web technologies including HTML, CSS, and JavaScript.

Build a new theme - Create a new theme based on Fluid's root themes (Fluid, Vox, or Base)

Customize a theme - Update the look and feel of an existing theme to tailor it to your company's unique brand and requirements


Table of Contents

  1. Getting Started
  2. Key Concepts
  3. Architecture
  4. Layouts
  5. Templates
  6. Sections
  7. Blocks
  8. Settings
  9. Config
  10. Locales
  11. Best Practices
  12. Migration Guide

Getting Started

Overview

Fluid themes are a package of template files, building blocks, and supporting assets that define how your company's pages look and function. The theme system provides multiple levels of customization, from simple CSS variable changes to complete template overrides.

Quick Start

  1. Choose a Root Theme: Select from Fluid, Vox, or Base themes
  2. Clone for Customization: Create a company-specific copy
  3. Configure Variables: Set brand colors, fonts, and spacing
  4. Customize Templates: Override specific page layouts as needed
  5. Publish: Activate your theme for all users

The theme system handles the technical implementation behind the scenes, allowing you to focus on design and customization.


Key Concepts

Themes vs Application Themes

Legacy Themes - Simple theme selection system for basic switching Application Themes - Full-featured system with template management, versioning, and customization

Theme Hierarchy

  • Root Themes: Platform-provided base themes (fluid, vox, base)
  • Company Themes: Company-specific themes that clone and customize root themes
  • Template Inheritance: Company themes can override specific templates while inheriting others

Template Types

Templates in Fluid themes handle different content types and page layouts:

Template TypePurposeExamples
Content TemplatesRender specific content itemsproduct, medium, library
Page TemplatesHandle page typeshome_page, shop_page, cart_page
Layout ComponentsProvide page structurenavbar, footer, layouts
Structural ComponentsReusable template partssections, components, config

Architecture

Theme-Company Relationships

CompanyintidPKstringnamestringsubdomainApplicationThemeintidPKintcompany_idFKNULL for root themesstringnametextvariablesJSON CSS variablestextcustom_stylesheettextglobal_stylesheetstringversionintstatus0=draft, 1=activeApplicationThemeTemplateintidPKintcompany_idFKintapplication_theme_idFKstringnameintthemeable_typeproduct, medium, home_page, etctextcontentLiquid or JSON templatestringformatliquid or jsonintstatus0=draft, 1=activebooleandefaultdefault for themeable_typeFileReferenceProductMediumPagehas many themeshas one current_themecontains templatesreferences filescan have specific templatecan have specific templatecan have specific template

Template Resolution Priority

  1. URL Parameter Override - ?template_id=123 (highest priority)
  2. Content-Specific Assignment - Individual content items with assigned templates
  3. Company Theme Default - Default templates in company's active theme
  4. Root Theme Fallback - Inherit from root theme if company theme lacks template

Request Flow

User Request → Controller → Template Resolution → Variable Population → Rendering → Response

Layouts

Layouts provide the structural wrapper for your content, defining the overall page structure including HTML document structure, navigation, and footer elements.

Layout Structure

<!DOCTYPE html>
<html lang="{{ request.locale.iso_code }}">
<head>
  <meta charset="utf-8">
  <title>{{ page_title | default: company.name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  <!-- Theme stylesheets with CSS variables -->
  <style>
    :root {
      --primary-color: {{ theme.variables.primary_color }};
      --font-family: {{ theme.variables.font_family }};
    }
  </style>
  
  {{ theme.global_stylesheet_with_variables | raw }}
  {{ theme.custom_stylesheet | raw }}
</head>
<body>
  <!-- Navigation -->
  
  <!-- Main content area -->
  {{ content_for_layout }}
  
  <!-- Footer -->
  
  <!-- JavaScript -->
  <script src="{{ 'theme.js' | asset_url }}"></script>
</body>
</html>

Layout Assignment

Templates can specify their layout using:

Liquid Templates:


<!-- Template content -->

JSON Templates:

{
  "layout": "theme",
  "sections": {
    // section definitions
  }
}

Custom Layouts

Create specialized layouts for different page types:

<!-- layouts/minimal.liquid -->
<!DOCTYPE html>
<html>
<head>
  <title>{{ page_title }}</title>
  {{ theme.global_stylesheet_with_variables | raw }}
</head>
<body class="minimal-layout">
  {{ content_for_layout }}
</body>
</html>

Templates

Templates define the structure and content for specific page types. Fluid supports both Liquid and JSON template formats.

Liquid Templates

Traditional server-side templating using Liquid syntax:


  Product page template


<article class="product-page">
  <header class="product-header">
    <h1>{{ product.name }}</h1>
    <div class="product-price">
      {{ product.price | money }}
    </div>
      <div class="product-tags">
        {{ product.tags | join: ', ' }}
      </div>
  </header>

  <div class="product-gallery">
      <img src="{{ image.url | img_url: '600x400' }}" 
           alt="{{ image.alt }}" />
  </div>

  <div class="product-description">
    {{ product.description }}
  </div>

    <button class="btn-purchase" data-product-id="{{ product.id }}">
      {{ 'products.add_to_cart' | t }}
    </button>
</article>