Shortcodes Reference
Categories:
The Layer5 Academy platform supports a wide range of shortcodes for enriching your learning content. Shortcodes are reusable template snippets you invoke in Markdown files to generate HTML output. They come from three sources:
- Academy Theme β custom shortcodes built specifically for the Academy platform.
- Docsy Theme β shortcodes inherited from the Google Docsy documentation theme.
- Hugo Built-in β shortcodes included with the Hugo static site generator.
For guidance on creating your own shortcodes, see Extending the Academy.
Academy Theme Shortcodes π
These shortcodes are defined in the academy-theme repository and are purpose-built for Academy content.
alert π
Displays styled alert boxes for important information. Supports multiple visual types.
Parameters:
| Parameter | Default | Description |
|---|---|---|
type | (none) | Alert style: danger, info, warning, or note. |
color | primary | Bootstrap color class (used when type is not set): danger, warning, info, primary, etc. |
title | Auto-set from type | Heading text displayed in the alert. |
Usage:
{{< alert type="info" title="Heads Up" >}}
This content supports **Markdown** formatting.
{{< /alert >}}
{{< alert type="warning" >}}
Proceed with caution.
{{< /alert >}}
{{< alert color="danger" title="Critical" >}}
This uses the color parameter instead of type.
{{< /alert >}}
Heads Up
This content supports Markdown formatting.chapterstyle π
Wraps content in a styled chapter container. Useful for applying custom CSS to a section of content.
Parameters:
| Parameter | Default | Description |
|---|---|---|
style | (none) | Inline CSS style string applied to the container. |
Usage:
{{< chapterstyle style="background: #f5f5f5; padding: 1rem;" >}}
Your styled content here.
{{< /chapterstyle >}}
details π
Creates a collapsible accordion block using the HTML <details> element.
Parameters:
| Parameter | Default | Description |
|---|---|---|
summary | (required) | Title text shown in the clickable summary bar. |
open | false | Set to "true" to expand the block by default. |
Usage:
{{< details summary="Click to expand" >}}
Hidden content revealed on click. Supports **Markdown**.
{{< /details >}}
{{< details summary="Open by default" open="true" >}}
This section starts expanded.
{{< /details >}}
image π
Displays an image with optional caption, alignment, sizing, and click-to-expand modal behavior.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | Image source URL or relative path. |
width | 100% | CSS width value. |
align | center | Text alignment: left, center, or right. |
alt | "" | Alt text for accessibility. |
title | "" | Caption displayed below the image. |
radius | 0% | CSS border-radius value. |
Usage:
{{< image src="./images/diagram.png" alt="Architecture diagram" title="System Overview" width="80%" radius="8px" >}}
local-video π
Embeds an HTML5 video player with playback controls.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | Video file URL or relative path. |
muted | (flag) | Mutes the video when present. |
autoplay | (flag) | Autoplays the video when present. |
loop | (flag) | Loops the video when present. |
Usage:
{{< local-video src="./videos/demo.mp4" autoplay muted loop >}}
meshery-design-embed π
Embeds an interactive Kanvas design visualization into the page.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | Path to the generated embed JavaScript file. |
id | (required) | Unique embed ID (typically embedded-design-{designId}). |
size | full | Container size: full (80% width) or half (50% width). |
style | (none) | Custom inline CSS (overrides size). |
host | https://cloud.layer5.io | Remote provider hostname. |
showOpenLink | true | Whether to show the “Open Design” link. |
Usage:
{{< meshery-design-embed src="./embed.js" id="embedded-design-abc123" size="full" >}}
pageinfo π
Creates a styled information box.
Parameters:
| Parameter | Default | Description |
|---|---|---|
color | primary | Color class for styling. |
Usage:
{{< pageinfo color="info" >}}
General information about this section.
{{< /pageinfo >}}
svg π
Loads and inlines an SVG file from the theme’s assets/icons/ directory.
Parameters:
| Parameter | Default | Description |
|---|---|---|
name | (required) | SVG filename without the .svg extension. |
Usage:
{{< svg name="logo" >}}
version π
Displays a colored text span, typically used for version identifiers.
Parameters:
| Parameter | Default | Description |
|---|---|---|
color | (required) | CSS color value for the text. |
Usage:
{{< version color="green" >}}v2.1.0{{< /version >}}
lab-intro π
Stores inner content as a lab introduction for use by the lab page template. This shortcode does not render output directly; instead, it passes content to the rendering pipeline.
Usage:
{{< lab-intro >}}
Welcome to this hands-on lab. You will learn to deploy a microservice.
{{< /lab-intro >}}
csvtable π
Generates a permissions table from a CSV data file, grouped by category. Reads from static/data/csv/keys-backup.csv. Used internally for permissions documentation.
Parameters: None.
csvtable-roles π
Generates a role-based permissions table from a CSV data file. Filters and groups data by role type and links to relevant role documentation pages. Used internally for roles documentation.
Parameters: None.
usestatic π
Deprecated
This shortcode is deprecated and should not be used in new content.Resolves the path to a static asset within the current tenant’s UUID scope.
Parameters:
| Parameter | Default | Description |
|---|---|---|
| (positional) | (required) | Path to the static asset. |
Usage:
{{< usestatic "images/logo.png" >}}
Output: /{tenant-uuid}/images/logo.png
Docsy Theme Shortcodes π
These shortcodes are provided by the Docsy theme. The Academy theme inherits them through Hugo module imports. For full details, see the Docsy shortcodes documentation.
tabpane / tab π
Creates tabbed content panels. Tabs can contain text or code blocks.
Parameters (tabpane):
| Parameter | Default | Description |
|---|---|---|
text | false | Set to true for text content (disables code highlighting). |
langEqualsHeader | false | Use tab header as the code language. |
persistLang | true | Remember selected tab across page loads. |
right | false | Right-align tabs. |
Parameters (tab):
| Parameter | Default | Description |
|---|---|---|
name | (required) | Tab header text. |
codelang | "" | Language for syntax highlighting. |
disabled | false | Disables the tab. |
Usage:
{{< tabpane text=true >}}
{{< tab name="Linux" >}}
Run: `sudo apt install meshery`
{{< /tab >}}
{{< tab name="macOS" >}}
Run: `brew install meshery`
{{< /tab >}}
{{< /tabpane >}}
card / cardpane π
Displays content in Bootstrap-style cards. Use cardpane to group multiple cards.
Parameters (card):
| Parameter | Default | Description |
|---|---|---|
header | (none) | Card header text. |
title | (none) | Card title. |
subtitle | (none) | Card subtitle. |
footer | (none) | Card footer text. |
code | false | Set to true to enable syntax highlighting for inner content. |
Usage:
{{< cardpane >}}
{{< card header="Step 1" >}}
Install the prerequisites.
{{< /card >}}
{{< card header="Step 2" >}}
Configure your environment.
{{< /card >}}
{{< /cardpane >}}
readfile π
Reads and displays the contents of an external file, with optional syntax highlighting.
Parameters:
| Parameter | Default | Description |
|---|---|---|
file | (required) | Path to the file (relative to the page or site root). |
code | true | Wrap output in a code block. |
lang | "" | Language for syntax highlighting. |
Usage:
{{< readfile file="config.yaml" code=true lang="yaml" >}}
imgproc π
Processes images using Hugo’s built-in image pipeline (resize, crop, fit, fill).
Parameters:
| Parameter | Default | Description |
|---|---|---|
| (positional 1) | (required) | Image filename (page resource). |
| (positional 2) | (required) | Processing command: Resize, Fit, Fill, or Crop. |
| (positional 3) | (required) | Processing options (e.g., 400x400). |
Usage:
{{< imgproc "hero.jpg" Resize "800x" >}}
Optional caption text.
{{< /imgproc >}}
iframe π
Embeds external content via an iframe with configurable options.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | URL to embed. |
width | 100% | Iframe width. |
tryautoheight | true | Attempt to auto-size the iframe height. |
sandbox | "" | Sandbox attribute for security restrictions. |
Usage:
{{< iframe src="https://example.com/embed" width="100%" >}}
swaggerui π
Embeds a Swagger UI instance for interactive API documentation.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | Path to the OpenAPI/Swagger JSON or YAML spec file. |
Usage:
{{< swaggerui src="/api/openapi.yaml" >}}
redoc π
Renders API documentation using ReDoc.
Parameters:
| Parameter | Default | Description |
|---|---|---|
src | (required) | URL or path to the OpenAPI spec file. |
Usage:
{{< redoc src="/api/openapi.yaml" >}}
comment π
Comments out a block of content so it is not rendered in the output.
Usage:
{{< comment >}}
This content will not appear in the rendered page.
{{< /comment >}}
conditional-text π
Shows or hides content based on a build condition defined in the site configuration.
Parameters:
| Parameter | Default | Description |
|---|---|---|
include-if | (required) | Condition name from site config to evaluate. |
Usage:
{{< conditional-text include-if="defined-condition" >}}
This text only appears when the condition is met.
{{< /conditional-text >}}
blocks/section π
Creates a full-width page section with optional color and height.
Parameters:
| Parameter | Default | Description |
|---|---|---|
color | (none) | Section background color: primary, secondary, info, warning, danger, light, dark, white. |
height | (none) | Section height: auto, min, med, max, full. |
type | section | Section type. |
blocks/lead π
Creates a lead paragraph section for introductory content.
Parameters:
| Parameter | Default | Description |
|---|---|---|
color | (none) | Background color. |
height | auto | Section height. |
blocks/cover π
Creates a cover/hero section with a background image.
Parameters:
| Parameter | Default | Description |
|---|---|---|
image_anchor | smart | Image crop anchor point. |
height | (none) | Section height: auto, min, med, max, full. |
color | (none) | Overlay color. |
title | (none) | Cover title. |
subtitle | (none) | Cover subtitle. |
logo | (none) | Path to a logo image. |
byline | (none) | Byline text. |
blocks/feature π
Creates a feature highlight box with an icon, typically used in groups of three.
Parameters:
| Parameter | Default | Description |
|---|---|---|
title | (required) | Feature title. |
url | (none) | Link URL. |
url_text | (none) | Link text. |
icon | (none) | Font Awesome icon name (e.g., fa-cogs). |
blocks/link-down π
Creates a downward navigation arrow that scrolls to the next section. Must be nested inside another block shortcode.
Parameters: None.
Hugo Built-in Shortcodes π
These shortcodes are included with Hugo itself and are always available. For full details, see the Hugo shortcodes documentation.
figure π
Renders an HTML <figure> element with an image and optional caption, link, and attributes.
Parameters:
| Parameter | Description |
|---|---|
src | Image URL. |
link | URL the image links to. |
target | Link target attribute. |
rel | Link rel attribute. |
alt | Alt text. |
title | Image title. |
caption | Figure caption (supports Markdown). |
class | CSS class for the <figure> element. |
height | Image height. |
width | Image width. |
attr | Attribution text. |
attrlink | Attribution link URL. |
Usage:
{{< figure src="./images/overview.png" title="System Architecture" caption="High-level view of the platform." >}}
gist π
Embeds a GitHub Gist.
Parameters:
| Parameter | Description |
|---|---|
| (positional 1) | GitHub username. |
| (positional 2) | Gist ID. |
| (positional 3) | (optional) Filename to display from a multi-file gist. |
Usage:
{{< gist "username" "gist-id" >}}
highlight π
Renders code with syntax highlighting. Equivalent to fenced code blocks but with more control.
Parameters:
| Parameter | Description |
|---|---|
| (positional 1) | Language for syntax highlighting. |
linenos | Show line numbers (true, false, table, inline). |
hl_lines | Lines to highlight (e.g., "3-5 8"). |
linenostart | Starting line number. |
Usage:
{{< highlight go "linenos=table,hl_lines=3" >}}
func main() {
fmt.Println("Hello")
fmt.Println("Highlighted line")
}
{{< /highlight >}}
param π
Outputs a site or page parameter value.
Usage:
{{< param "description" >}}
ref / relref π
Creates absolute (ref) or relative (relref) permalinks to other pages.
Usage:
[Link text]({{< ref "/cloud/academy" >}})
[Relative link]({{< relref "extending-the-academy" >}})
youtube π
Embeds a YouTube video.
Parameters:
| Parameter | Description |
|---|---|
(positional 1) or id | YouTube video ID. |
title | Accessible title for the iframe. |
loading | Loading behavior (eager or lazy). |
Usage:
{{< youtube "dQw4w9WgXcQ" >}}
vimeo π
Embeds a Vimeo video.
Parameters:
| Parameter | Description |
|---|---|
(positional 1) or id | Vimeo video ID. |
title | Accessible title for the iframe. |
Usage:
{{< vimeo "12345678" >}}