R02

Error

Routes

R02 — A route parameter and a page parameter that do not match

A route's :name fills the page's parameter of that name; a :name with no parameter is read as nothing, and a parameter with no :name is never filled.

What the compiler said

error[R02]: the route `/u/:id` names `:id`, and the page declares no parameter `id` --> src/App.wf:1:1 | 1 | page Profile(path: "/u/:id", title: "T", description: "D") { | ^^^^ = help: Declare it: `page Profile(path: "/u/:id", id: String)`, then read `id` = docs: https://webfluent.monzeromer.dev/errors/R02

The fix

Broken

wf

page Profile(path: "/u/:id", title: "T", description: "D") { Heading("Profile").h1 }

Fixed

wf

page Profile(path: "/u/:id", title: "T", description: "D", id: String) { Heading("Profile {id}").h1 }

Declare the parameter the route names — page Profile(path: "/u/:id", id: String) — and read it by name; a declared parameter the route has no :name for is never filled.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints cannot lower it: it would ship a broken page.