Alerts

A common pattern is to show alerts such as tips, warnings or info messages. The std::alert plugin provides an alert block partial which makes it easy to add alerts to your pages.

Project source code

You should add the dependency to your site settings to use it:

[dependencies]
"std::alert" = "^1"

Afterwards, you can use the alert partial like this:

{{#>alert}}
This is an alert with *seamless* Markdown handling.
{{/alert}}

Renders to:

This is an alert with seamless Markdown handling.

When a type is passed to the partial it is appended to the class for the element:

{{#>alert type="warn"}}
This is a warning.
{{/alert}}

Renders to:

This is a warning.

Add a label to render a title:

{{#>alert type="error" label="error"}}
This is an error.
{{/alert}}

Renders to:

error

This is an error.

If you want to use the default styles apply them in the dependency:

[dependencies]
"std::alert" = { version = "^1", apply = { styles = [ "**" ] } }