Quick Start
Sections are the building blocks of all pages in Spree Storefront. There are two types of sections:Layout sections
- eg. Header, Footer
- Present on all pages
Content sections
- eg. Hero, Featured Products
- Present on specific pages
- can be managed via the Page Builder

File | Description | Example |
---|---|---|
ActiveRecord model | Defines the section’s preferences | Spree::PageSections::ImageWithText |
Storefront view | Renders the section in the storefront - each theme can have its own view | image_with_text.html.erb |
Admin page builder form | Configures the section in the admin panel | image_with_text/_form.html.erb |
Layout Sections
We have two types of layout sections - Header and Footer. As the name suggests, they are rendered at the top and bottom of the page respectively. Between them, we have a main content area that is used to render the page sections.Header sections
Announcement Bar

Header

Footer sections
Newsletter

Footer

Content Sections
Documentation on content sections is coming soon
Architecture
Let’s dive into the details of how sections work.Active Record Model
Each section’s model inherit from Spree::PageSection abstract model class.Associations
Each sections has many blocks and links. You can call them viasection.blocks
and section.links
respectively.
Section belongs to a polymorphic parent model called pageable
which can be either Spree::Page
(content sections) or Spree::Theme
(layout sections).
You can access section’s theme by calling section.theme
.
Preferences
Each section has set of default preferencesName | Description | Default Value |
---|---|---|
text_color | Color of text in the section | nil - uses theme’s text color |
background_color | Background color of the section | nil - uses theme’s background color |
border_color | Color of section borders | nil - uses theme’s border color |
top_padding | Padding space above section content (in pixels) | 40 |
bottom_padding | Padding space below section content (in pixels) | 40 |
top_border_width | Width of top border (in pixels) | 1 |
bottom_border_width | Width of bottom border (in pixels) | 0 |
Spree::PageSections::ImageWithText
has desktop_image_alignment
and vertical_alignment
preferences.
Creating a new section
Documentation on creating a new section is coming soon