Skip to content

Custom shortcodes (and partials)

Hans5958 edited this page Mar 8, 2022 · 2 revisions

Other than the shortcodes and partial templates implemented in Hugo, here are some other that you can use on this website.

Shortcodes

These can be used on general content pages.

Admonition (admonition)

These are like alerts, but they are more "friendly," sort-to-speak. These are based fom Bootstrap 4 docs.

Types

Type Aliases
info note, abstract, summary, tldr, todo, tip, hint, important
success check, done
warning caution, attention
danger failure, fail, missing, error, bug

From top to bottom: info, success, warning, danger

image

Example

This admonition will have the type info.

{{< admonition info >}}

_Already translated: **Italian, Japanese, Portuguese, Slovenian and Spanish**. We won't be accepting any new translators for these languages_

{{< /admonition >}}

Player modal (youtube)

See the respective partial variation.

Example

{{< youtube "nQ4N9zlzj0M" >}}

scss

See the respective partial variation.

Example

{{< scss "assets/css/base.scss" >}}

Partial templates

These can be used on layout pages and the shortcode itself.

Player modal (youtube)

Using this shortcode will result in an image with the play button in the middle, at which can be clicked to display a modal with the video.

Accepts a dictonary as an argument, usually contains the video ID.

Currently, it only supports YouTube, but may be expanded if needed.

Examples

{{ partial "youtube" (dict "id" "nQ4N9zlzj0M") }}

scss

This can be used if you want to use .scss instead of .css. Using this link will compile the .scss into .css, and then embeds the compiled .css into the page.

Example

{{ partial "scss" "assets/css/base.scss" }}