Layouts

Y is a fantastic tool for making layouts. This website is built using the Y layout system.

Y: Layout definition precedence

Y Layouts let you define different layout renderings for different themes. Any module or active theme in the subtheme chain can define a layout using a particular protocol.

This is the order of discovery for layouts. Each layout is defined with the template API.

  1. layout
  2. theme-layout-skin (theme setting)
  3. theme-layout (for each theme up the subtheme chain)
  4. theme-layout_default (for each theme up the subtheme chain)
  5. layout_default

What this means is that if you want to provide a basic, generic, plain-vanilla layout with your application, you should define it in the layout_default protocol.

Individual themes and subthemes should define their default layouts in the exampletheme-layout_default protocol.

Layout overrides for particular themes should be defined by the exampletheme-layout protocol.

For themes that allow different skins, then layouts for each skin should be defined within the exampletheme-layout-exampleskin protocol.

If you want to trump all other layout definitions and take complete control, then use the layout protocol.

3 / 2020