hypra

SEM-009: html, body or title written by hand

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

Hypra writes the document around the page itself: <html> with the page's lang, <head> with the title and meta tags, and <body> with the page in it. A second one would make the HTML invalid.

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  body(class: "dark") { p "All our running shoes." }
}
error[SEM-009]: Hypra writes <body> itself
 --> page.hypra:3:3
  |
3 |   body(class: "dark") { p "All our running shoes." }
  |   ^^^^
  = help: set <html> attributes on page(...), and <body> attributes with body(...) inside the page or layout
  = docs: https://hypralang.dev/rules/sem-009/

1 error, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  body(class: "dark")
  p "All our running shoes."
}

Attributes for <body> go on a body without content, in the page or its layout. Attributes for <html> go on the page, like page(lang: "de", ...), and the title is page(title: ...).