Skip to main content
Links are used to create navigation throughout the storefront. They can be assigned to sections and blocks, enabling users to navigate to different pages, products, categories, or external URLs. The Spree::PageLink model provides a flexible way to link to various content types:
  • Internal pages - Link to Pages, Products, Taxons, Posts
  • External URLs - Link to any external website
  • Special links - Email (mailto:) and phone (tel:) links
Links are managed through the Page Builder interface, where store staff can select what each link points to. The Spree::PageLink model has these key attributes:

Linkable Types

Links can point to various Spree models: For sections that need one link (like a banner):
app/models/spree/page_sections/promo_banner.rb
For sections that need multiple links (like navigation):
app/models/spree/page_sections/footer.rb
Blocks can also have links. Use the Spree::HasOneLink concern for single links:
app/models/spree/page_blocks/cta_button.rb

Using the Helper

The page_builder_link_to helper renders links with Page Builder support:
For more control, you can render links manually:
In your section’s admin form, render the link editor:
app/views/spree/admin/page_sections/forms/_promo_banner.html.erb
The linkable_url method returns the appropriate URL:

Automatic Label Setting

When a link’s linkable is set, the label is automatically populated from the linked resource:
The label is derived from (in order):
  1. linkable.title
  2. linkable.display_name
  3. linkable.name
  • Sections - Adding links to sections
  • Blocks - Adding links to blocks
  • Pages - Understanding internal page linking