Overview

How a page builds its content from blocks, and the keys they share

Overview

A page builds its content from a blocks list in its front matter. Each entry declares a type, the fields that type understands, and an optional ui object holding everything about how the block looks.

blocks:
  - type: title
    heading:
      surtitle: 'Lorem ipsum'
      title: 'Dolor sit amet'
    ui:
      theme: dark
      grid: medium
      offset: center

Common keys

Each block page documents its own fields. These keys are shared.

heading

Rendered at the top of the block by blocks/heading.html . Blocks whose content is a heading (paragraph, editorial, alert, quote) carry surtitle / title / text at their root instead.

heading: {} # (optional)
  surtitle: '' # string (optional)
  title: '' # string (optional)
  text: '' # markdown (optional)
  ctas: [] # (optional, front matter only)

footing

Rendered at the bottom of the block by blocks/footing.html . The title block has no footer.

footing: {} # (optional, front matter only)
  text: '' # markdown (optional)
  ctas: [] # (optional)

footing and heading.ctas are read by the theme but have no field in Hugolify Admin yet: they are set in the front matter, not from the CMS.

ctas

The same shape everywhere a block takes buttons.

ctas: []
  text: '' # string
  url: '' # url
  blank: false # boolean, open in a new tab (optional)
  link: false # boolean, render as a plain link instead of a button (optional)
  lang: '' # code lang, sets the hreflang attribute (optional)

hreflang is accepted as a synonym of lang, and wins when both are set.

ui

Everything about how the block looks. The value is the CSS class: theme: dark renders block-dark, grid: full renders block-full. A value the active styling module does not implement renders markup with no visual effect, never an error.

KeyValuesBlocks
themeaccent black dark highlight light neutral whiteall
gridxsmall small medium large container fullall
offsetstart center endall
alignstart center endall
columnnumber of columns per row on desktopcomparison, datas, gallery, informations, logos, paragraph-list, pushes
rationumber, thumbnail aspect ratiogallery, informations
scrollsnapnone sm md lg xl all, or an objectcomparison, datas, gallery, informations, latest, logos, pushes, selected, testimonials
layoutgrid list carousel, per blockgallery, latest, logos, pushes, selected, testimonials
directionltr rtleditorial
carouselobject, only with layout: carouselgallery, logos, pushes, selected, testimonials

Any of these can be set once for a whole block type, under <type>.ui in /data/blocks.yml, the Blocks file the CMS edits in the config collection. A block of a page overrides it, and drops a default by writing the key under its own ui, even empty.

See defaults per block See the UI reference

scrollsnap

Below a breakpoint, a row of items becomes a horizontal carousel with snap points. The value is the rung at which the carousel stops and the grid comes back.

ui:
  scrollsnap: md # shorthand for breakpoint md
ui:
  scrollsnap:
    breakpoint: md # [sm, md, lg, xl, all, none]
    nav: pointer # [true, false, pointer] prev/next buttons
    pagination: true # [true, false, pointer] dots

Each key falls back through a ladder, most specific first, so a block overrides one without repeating the others: the block itself, its block type and every block in /data/blocks.yml, then the whole site in the params.

/data/blocks.yml

datas:
  ui:
    grid: medium
    scrollsnap: lg # the datas blocks
ui:
  scrollsnap:
    nav: pointer # every block

/config/_default/params.yaml

scrollsnap:
  pagination: true # the whole site, lists of entries included

The site-wide level stays in the params, as it also serves the lists of entries outside the blocks. A level may write the key at the level itself rather than under its ui, the older form, still read, and ui wins when a level carries both. hugolify-theme also still reads the block levels from params.blocks, below the data file.

Unlike the other ui keys, scrollsnap is resolved by func/SetScrollsnap.html rather than GetBlockUI: it does not become a block-* class, it puts a utility class on the row of items.

Defaults: breakpoint md, nav: false, pagination: false.

A real carousel, driven by Splide, as opposed to the CSS-only scrollsnap. Only read when layout: carousel.

column does not apply here: it sizes the grid layout, while a carousel slot’s width comes from params.perPage.

ui:
  carousel: {} # (optional)
    params: {} # (optional)
      focus: '' # boolean (optional)
      autoplay: true # boolean (optional)
      arrows: true # boolean (optional)
      pagination: false # boolean (optional)
      type: '' # [slide, loop, fade] (optional)
      perPage: '' # number (optional)
      padding: '' # number (optional)
      gap: '' # number (optional)
    responsive: {} # (optional)
      breakpoints: 640 # number [640, 768, 1024, 1280, 1440]
      params: {} # same keys as above

Legacy front matter

Before v2 the ui keys sat flat at the root of the block, and the theme mapped background: true to the bg theme. func/GetBlockUI.html still reads that form, so v1 content keeps rendering. ui wins whenever both are set, and only ui is documented here.

# Legacy, still read
blocks:
  - type: informations
    background: true
    column: 3

# Current
blocks:
  - type: informations
    ui:
      theme: bg # light is better though
      column: 3
See the v1 to v2 migration guide