Admonitions on Joulsen
An admonition is, according to the dictionary, a firm warning or reprimand. But in documentation and the programming world, they are less threatening - they are just some boxes with warnings, info or similar.

Admonitions as they appear in the popular Material for MkDocs.
I sometimes have to correct some things on my page, or make a small callout, and they are quite useful. Therefore, I created a very minimal admonition that fits with the rest of my website.
Hello
With Hugo, articles (like this one) are written in Markdown and converted to HTML before being inserted into templates. These articles cannot (or rather, should not) contain arbitrary HTML and CSS, but there is a way to define these short snippets, such that they can be used in Markdown.
The feature is called a Hugo shortcode, and it is a keyword, which when written in Markdown is converted to corresponding HTML by Hugo.
There are a couple of pre-defined shortcodes, such as figure which I use for almost all pictures in my posts.
But you can also define your own, place it in layouts/shortcodes/<name> after which you can use it in Markdown by typing {{\<name>}} (no backslash).
The shortcode for my admonition is seen below:
|
|
The different {{ }} elements you see are Go templates.
These let you take arguments to the template.
For example, the admonition above is produced by the following code:
|
|
Note
HTML without CSS is not a pretty sight, so I have a style defined as well. If you want to see the styling, just inspect the admonition in your browser.
Published 29. May 2025
Last modified 29. May 2025