When you extend the HtmlPage
you get basic support for a HTML page.
First we'll define a template for all our pages.
Here we can put site-wide settings, include common JS and CSS dependencies.
For basic site settings you override def siteSettings
. It has the following fields:
Name | Mandatory | Type | Default value | Description |
---|---|---|---|---|
name | No | Option[String] | None | Name of this site |
faviconNormal | No | Option[String] | None | Favicon of this site |
faviconInverted | No | Option[String] | None | Favicon with alternative color, can be used in navbar for example |
SiteSettings
are usually defined in a common trait, for example:
package utils
import Bundle.*
trait MyPageTemplate extends Page {
override def siteSettings = super.siteSettings
.withName("example.com")
.withFaviconNormal("favicon.jpg")
}
Per-page settings are in the def pageSettings
.
PageSettings
has the following fields:
Name | Mandatory | Type | Default value | Description |
---|---|---|---|---|
title | No | String | changeme | Title of this page |
label | No | String | <same as title> | Label used for link to this page |
language | No | String | en | Language of this page |
description | No | Option[String] | None | Description of page content |
package files
import utils.*
object Index extends MyPageTemplate {
override def pageSettings =
super.pageSettings
.withTitle("Welcome!")
.withDescription("My cool site")
}
Next up is the def bodyContent: List[Frag]
method.
You guessed it, it is the <body>
of your HTML page. :)
Here you type content to be rendered in the body of your page.
Next up is the def headContent: List[Frag]
method.
Yup, it is the <head>
of your HTML page.
It has some defaults, you can see them in source code or inspect it in browser.