This page demonstrates all available shortcodes in the Hugo Narrow theme.

Hugo Built-in Shortcodes

Hugo provides several built-in shortcodes . The content of these shortcodes is subject to change without notice, so you can visit the official page for detailed usage instructions.

The built-in shortcodes include:


Theme Custom Shortcodes

Icon

Display SVG icons from the theme’s icon library:

MARKDOWN
{{< icon name="heart" >}}
{{< icon name="github" size="lg" >}}
{{< icon name="sun" class="text-primary" >}}
Нажмите, чтобы развернуть и увидеть больше

Example:

Parameters:

Button

Create styled buttons with theme colors:

MARKDOWN
{{< button text="Learn More" url="/about" >}}
{{< button text="GitHub" url="https://github.com" icon="github" target="_self" >}}
{{< button text="Download" url="/download" variant="outline" size="lg" >}}
Нажмите, чтобы развернуть и увидеть больше

Example:

Primary Button Secondary Button Outline Button Small Size Medium Size Large Size With Icon External Link

Parameters:

Display a link card with a website icon:

MARKDOWN
{{< link title="Google" description="The world largest search engine." url="https://google.com" icon="https://google.com/favicon.ico" >}}
Нажмите, чтобы развернуть и увидеть больше

Examples:

Bilibili

Embed Bilibili videos:

MARKDOWN
{{< bilibili BV号 >}}
{{< bilibili AV号 分P号 >}}
Нажмите, чтобы развернуть и увидеть больше

Tencent Video

MARKDOWN
{{< tencent 视频ID >}}
Нажмите, чтобы развернуть и увидеть больше

Create a waterfall-style image gallery:

MARKDOWN
{{< masonry >}}
![Image 1](/images/1.jpg)
![Image 2](/images/2.jpg)
![Image 3](/images/3.jpg)
{{< /masonry >}}
Нажмите, чтобы развернуть и увидеть больше

版权声明

Автор: Hugo Narrow

Ссылка: http://localhost:1313/posts/shortcode-examples/

Лицензия: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Начать поиск

Введите ключевые слова для поиска статей

↑↓
ESC
⌘K Горячая клавиша