hypra

LAYOUT-005: layout inside itself

Error: the page doesn't build until this is fixed.

A layout can sit inside another one, like a shop's frame inside the site's, but never inside itself: the frames would go on forever.

Fails

layout Shop(layout: Shop) {
  main { slot }
}

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.", layout: Shop) {
  h1 "Shoes"

}
error[LAYOUT-005]: layout `Shop` ends up inside itself
 --> page.hypra:1:21
  |
1 | layout Shop(layout: Shop) {
  |                     ^^^^
  = help: a layout can sit inside another one, but never inside itself
  = docs: https://hypralang.dev/rules/layout-005/

1 error, 0 warnings

Fixed

layout Base(lang: "en") {
  main { slot }
}

layout Shop(layout: Base) {
  nav(aria-label: "Shop") { a("/shoes") "All shoes" }
  slot
}

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.", layout: Shop) {
  h1 "Shoes"

}