This guide assumes you’ve completed the Storefront tutorial and have working brand pages.
What We’re Building
By the end of this tutorial, you’ll have:- A Brand List page type manageable via Page Builder
- A Brand page type for individual brand pages
- Custom sections:
BrandGridandBrandBanner - Full admin customization support
Understanding Page Builder Architecture
Page Builder uses three main components:| Component | Purpose |
|---|---|
| Page | Defines the page type (e.g., Homepage, Product Details, Brand List) |
| Section | Reusable content blocks within a page (e.g., Hero Banner, Product Grid) |
| Block | Smallest units within sections (e.g., Heading, Text, Button) |
Step 1: Create Page Types
Brand List Page
Create a page type for the brands listing:app/models/spree/pages/brand_list.rb
Brand Page
Create a page type for individual brand pages:app/models/spree/pages/brand.rb
Step 2: Register Pages
Add your pages to the Spree configuration:config/initializers/spree.rb
Step 3: Create Custom Sections
Brand Grid Section
This section displays a grid of all brands:app/models/spree/page_sections/brand_grid.rb
Brand Banner Section
This section displays the brand header with logo and description:app/models/spree/page_sections/brand_banner.rb
Step 4: Register Sections
Add your sections to the configuration:config/initializers/spree.rb
Step 5: Create Admin Forms
Admin section forms use Spree’s Admin Form Builder, which provides helper methods likespree_select and spree_check_box for consistent styling and functionality.
Brand Grid Admin Form
app/views/spree/admin/page_sections/forms/_brand_grid.html.erb
Brand Banner Admin Form
app/views/spree/admin/page_sections/forms/_brand_banner.html.erb
Step 6: Create Storefront Views
Brand Grid Section View
app/views/themes/default/spree/page_sections/_brand_grid.html.erb
Brand Banner Section View
app/views/themes/default/spree/page_sections/_brand_banner.html.erb
Step 7: Update the Controller
Update your controller to use Page Builder pages:app/controllers/spree/brands_controller.rb
Step 8: Update Views to Use Page Builder
Brand List Index View
app/views/themes/default/spree/brands/index.html.erb
Brand Show View
app/views/themes/default/spree/brands/show.html.erb
render_page helper automatically renders all sections in the order defined in Page Builder.
Step 9: Passing Variables to Sections
Section views receive variables passed torender_page. Update your section views to use them:
app/views/themes/default/spree/page_sections/_brand_banner.html.erb
Step 10: Add Translations
config/locales/en.yml
Testing Page Builder Integration
- Start your Rails server
- Go to Admin → Storefront → Pages
- You should see “Brand List” and “Brand” pages
- Click on a page to customize it in Page Builder
- Add, remove, or reorder sections
- Customize section settings
- Preview changes in real-time
Section Roles Explained
| Role | Description | Can Delete? | Example |
|---|---|---|---|
content | General content sections | Yes | BrandGrid, ImageBanner |
system | Core page functionality | No | BrandBanner, ProductDetails |
header | Layout header sections | No | Header, AnnouncementBar |
footer | Layout footer sections | No | Footer, Newsletter |
Complete File Structure
After completing this tutorial, you should have:Benefits of Page Builder Integration
| Without Page Builder | With Page Builder |
|---|---|
| Developers edit views for layout changes | Admins customize layouts in browser |
| Code deployment required for design changes | Real-time preview and publish |
| Fixed page structure | Drag-and-drop section ordering |
| Hardcoded settings | Admin-configurable preferences |

