new Html(request, response)
Create a new Html object. Sets the Response.contentType to 'text/html'
Parameters:
| Name | Type | Description | 
|---|---|---|
| request | Request | The Request object passed to your Class | 
| response | Response | The Response object passed to your Class | 
Members
appleTouchIcons :Array.<Object>
Get and Set the link tag apple-touch-icon sizes and href.
Type:
- Array.<Object>
Properties:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Icons | Array.<Object> | Properties
 | 
Example
html.appleTouchIcons = [
   {'size': 152, 'href': '/static/icon-152.png'},
   {'size': 167, 'href': '/static/icon-167.png'},
   {'size': 180, 'href': '/static/icon-180.png'}
 ]body :string
Get and Set the body tag.
Type:
- string
Example
html.body = "<div>hello world</div>";bodyBottom :string
Get and Set any string at bottom of
tag (eg extra scripts)Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| str | string | 
Example
html.bodyBottom = `<script type="text/javascript">const FOO = 'bar';</script>`;canonicalUrl :string
Get and Set the canonical link href.
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| href | string | 
Example
html.canonicalUrl = 'https://example.com';csrf :string
Get and Set a csrf string. If set the html will insert localStorage.setItem('csrf', csrf) into the body and set 'csrf' cookie. Accepts a string or boolean. If boolean is true a random csrf value will be created for you.
Type:
- string
Properties:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| csrf | string | boolean | <optional> | 
Example
html.csrf = true;css :Array.<string>
Get and Set css link tags
Type:
- Array.<string>
Properties:
| Name | Type | Description | 
|---|---|---|
| href | Array.<string> | 
Example
html.css = ['style.css', 'fonts.css']description :string
Get and Set the description meta tag content.
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| description | string | 
Example
html.description = 'Some description';(readonly) document :string
get the contents of the document tag. This will incorporate many of the Class members (eg head, body, scripts, etc)
Type:
- string
favIcon :string
Get and Set the url for the shortcut icon
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| str | string | The url to set | 
Example
html.favIcon = 'https://example.com/favicon.png';(readonly) head :string
get the contents of the head tag. This will incorporate many of the Class members (eg description, favIcon, etc)
Type:
- string
headBottom :string
Get and Set any string at bottom of
tag (eg extra scripts)Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| str | string | 
Example
html.headBottom = `<script type="text/javascript">const FOO = 'bar';</script>`;metaTags :Array.<string>
Get and Set meta tags
Type:
- Array.<string>
Properties:
| Name | Type | Description | 
|---|---|---|
| name | Array.<string> | |
| property | Array.<string> | |
| content | Array.<string> | 
Example
html.metaTags = [
   {'name': 'title', 'content': 'Some Title'},
   {'property': 'og:description', 'content': 'Some Description'}
 ]scriptModules :Array.<string>
Get and Set script type="module" tags
Type:
- Array.<string>
Properties:
| Name | Type | Description | 
|---|---|---|
| src | Array.<string> | 
Example
html.scripts = ['module.js', 'component.js'];scripts :Array.<string>
Get and Set script type="text/javascript" tags
Type:
- Array.<string>
Properties:
| Name | Type | Description | 
|---|---|---|
| src | Array.<string> | 
Example
html.scripts = ['index.js', 'home.js'];themeColor :string
Get and Set the theme-color meta tag content
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| Hex | string | color | 
Example
html.themeColor = '#ffffff';title :string
Get and Set the title tag.
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| title | string | 
Example
html.title = 'Some title';webAppTitle :string
Get and Set the apple-mobile-web-app-title meta tag content. If set this will also set the apple-mobile-web-app-capable content to yes
Type:
- string
Properties:
| Name | Type | Description | 
|---|---|---|
| title | string | 
Example
html.webAppTitle = 'Some title';