Documentation
¶
Overview ¶
Package title provides constructors and methods for the HTML <title> element.
The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab. It only contains text; HTML tags within the element, if any, are also treated as plain text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<title") TagClose = []byte("</title>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new title element with text content Example: title.New() Renders: <title></title>
func RawText ¶
func RawText(content string) *element
RawText creates a new title element with raw text content. Uses text.RawText which is not HTML-escaped. Example: title.RawText("Page & Title") Renders: <title>Page & Title</title>
func RawTextf ¶
RawTextf creates a new title element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: title.RawTextf("%s — My App", page) Renders: <title>Home — My App</title>
func Static ¶
func Static(content string) *element
Static creates a new title element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: title.Static("Dashboard") Renders: <title>Dashboard</title>