Tutorial: build a landing page with layouts
This tutorial is for a designer, working with an editor, who wants a landing page composed of blocks: a hero, three features, a list of articles, a call to action. Allow one to two hours. It assumes your design draws layouts (Layouts for designers); the media and starter designs already do.
Contents
- Step 1: the pagelayout draws layouts
- Step 2: decide the blocks
- Step 3: style the blocks
- Step 4: build the layout
- Step 5: map it to the page
- Step 6: publish and check
Step 1: the pagelayout draws layouts
In your pagelayout.tpl, where {$module_result.content} used to be:
def $page_layout = fetch( 'explayouts', 'resolve_layout', hash() )
if $page_layout
include uri='design:explayouts/layout.tpl' layout=$page_layout module_result=$module_result
else
$module_result.content
/if
undef $page_layoutPages without a matching rule look exactly as before.
Step 2: decide the blocks
| Section of the page | Block (definition) | View type |
|---|---|---|
| Big picture with headline and button | hero | default |
| Three selling points | three_columns with rich_text children | default |
| Latest articles | list with a query collection | grid |
| Call to action | button | default |
Pick from the blocks your installation offers (Block definitions); a new look is usually a new view type, not a new block.
Step 3: style the blocks
Open the template of each block in your design (copy it from extension/explayouts/design/standard/templates/explayouts/block/
if your design has none) and give it the markup you want; then style by class in a stylesheet the pagelayout loads:
.slb-hero { padding-block: var(--site-space-5); background: var(--site-card); }
.slb-hero h1 { font-size: var(--site-text-xl); }
.slb-zone > * + * { margin-block-start: var(--site-space-5); }Use tokens so the page works in dark mode (Styling layout blocks).
Step 4: build the layout
With the editor, in the administration's layouts editor:
- New layout, layout type with a header, main and footer zone (or the type your design uses), name it "Spring campaign".
- Link the header and footer zones to the shared header and footer layout, so the page keeps the site's chrome (Shared layouts and linked zones).
- Add the blocks to the
mainzone in order; fill their fields; give the list block its collection (for example the children of the News folder, limit 6). - Preview.
Step 5: map it to the page
Create a rule: the layout "Spring campaign", target node (the landing page) or subtree, optionally a time condition for the campaign period, a priority above the general rules (Layout rules).
Step 6: publish and check
- Publish the layout (the site reads only published layouts).
- Open the landing page signed out.
- Check at 1440 px, at 960 px with scale 2 and at 375 px; in light and dark mode; with the keyboard.
- Check one
h1(the hero) and headings in order (Landmarks and headings). - Check layout shift: images in the hero and grid have sizes (Measuring CLS and LCP).
If the page shows another layout, a rule with a higher priority matches first; if it shows no layout, the rule is disabled or the layout not published.
Related pages
- Layouts for designers
- Block view templates
- The layouts editor
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.