Featured image of post Shortcodes

Shortcodes

Sample article showcasing various shortcodes supported by Stack theme.

Stack theme also provides some custom shortcodes to enhance your content.

Quote

The quote shortcode allows you to display a quote with an author, source, and URL.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

A famous person, The book they wrote

Usage

1
2
3
{{< quote author="Author Name" source="Source Title" url="https://example.com" >}}
Quote content here.
{{< /quote >}}

Video

The video shortcode allows you to embed self-hosted or remote video files.

Usage

1
{{< video src="https://example.com/video.mp4" >}}

Bilibili

Embed videos from Bilibili. Supports both av and bv IDs.

Usage

1
{{< bilibili "BV1634y1t7xR" >}}

YouTube

Hugo’s built-in YouTube shortcode.

Usage

1
{{< youtube ZJthWmvUzzc >}}

Tencent Video

Embed videos from Tencent Video.

Usage

1
{{< tencent "u00306ng962" >}}

GitLab Snippet

Embed snippets from GitLab.

Usage

1
{{< gitlab 2349278 >}}

GitHub Repository

The github-repo shortcode displays a repository’s description, primary language, star count, and fork count.

Usage

1
{{< github-repo "owner/repository" >}}

Details

The details shortcode creates a collapsible content block. Content inside supports markdown.

Click to expand

This content is hidden by default. You can put markdown content here, including:

  • Lists
  • Links
  • Code snippets
  • Images

Even blockquotes work inside!

You can also make it start in the expanded state with open=true:

Already expanded
This content is visible from the start, but can still be collapsed by clicking the header.

Usage

1
2
3
4
5
6
7
{{< details title="Click to expand" >}}
Hidden content with **markdown** support.
{{< /details >}}

{{< details title="Already expanded" open=true >}}
This starts visible.
{{< /details >}}

Diagrams

Stack supports Mermaid diagrams out of the box.

Usage

Wrap your Mermaid code in a code block with the language set to mermaid.

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```
Built with Hugo
Theme Stack designed by Jimmy