scalatrascalate

Value not set error in Scalate/Jade


I am new to Jade and Scalate. I have the following route defined:

get("/") {
  jade("index",
    "pageTitle" -> "Welcome to Jade",
    "welcomeMessage" -> "Hello my pretties")
}

And the template:

-@ val pageTitle: String
-@ val welcomeMessage: String

!!! 5
html(lang="en")
  head
    title= pageTitle
  body
    h1= welcomeMessage

The error I get on page render is:

The value for 'title' was not set
org.fusesource.scalate.NoValueSetException: The value for 'title' was not set
at org.fusesource.scalate.RenderContext$$anonfun$attribute$1.apply(RenderContext.scala:159)

Even if I remove the line title= pageTitle I still get the error. What is the error referring to and how do I fix it?


Solution

  • I didn't notice default.scaml in the layouts folder. It was defining, but not setting, title.