hugo-theme-next/exampleSite/content/post/12-shortcodes/index.en-us.md
2025-01-30 11:32:22 +08:00

5.0 KiB
Raw Blame History

title description Keywords date lastmod categories tags url toc
Custom shortcode example Set commonly used block references, label cards, buttons, and other information as short codes for quick referencing short code, short code 2025-01-29T21:08:50+08:00 2025-01-29T21:08:50+08:00
Example
Grammar
ShortCode
Grammar
demo/shortcodes.html true

Although the Markdown syntax is already very rich and can meet the vast majority of our writing needs, in order to better layout the content of the article in a more friendly way, a set of custom phrases has been designed for citation, which can be quickly referenced when used.

Block reference

When quoting some classic quotes, this phrase can be used. The grammar reference is as follows:

{{</* quote */>}}

###  block quote

Write down the words you want to express!
{{</* /quote */>}}

Actual effect:

{{< quote >}}

Hope is indifferent to existence, indifferent to nothingness, just like the road on earth.

In fact, there is no road on the ground, and with more people walking, it becomes a road.

Lu Xun

{{< /quote >}}

Information Block

Support 'default'` The presentation of five different effects, including info, success, warning, and danger, with the following syntax reference:

{{</* note [class] [no-icon] */>}}
Write and express information
Support Markdown syntax
{{</* /note */>}}

Actual effect:

{{< note default no-icon >}}

Default Header without icon

Welcome to Hugo NexT! {{< /note >}}

{{< note default >}}

Default Header

Welcome to Hugo NexT! {{< /note >}}

{{< note primary >}}

Primary Header

Welcome to Hugo NexT! {{< /note >}}

{{< note info >}}

Info Header

Welcome to Hugo NexT! {{< /note >}}

{{< note success >}}

Success Header

Welcome to Hugo NexT! {{< /note >}}

{{< note warning >}}

Warning Header

Welcome to Hugo NexT! {{< /note >}}

{{< note danger >}}

Danger Header

Welcome to Hugo NexT! {{< /note >}}

Bilibili video

{{</* bilibili BV1Sx411T7QQ */>}}
perhaps
{{</* bilibili id=BV1Sx411T7QQ */>}}

{{< bilibili id=BV1Sx411T7QQ >}}

Music player

Based on Player And MatingJS The library implements a responsive music player embedded in the meeting, with automatically recognized music platform URLs, including:` Netease, Tencent, Kugou, Baidu, and Xiami platforms also support user-defined music sources. Other relevant parameter explanations are as follows:

Parameter Name Default Description
id Required Music ID, which is the unique identifier of the music on the music platform
server Required Music platform, supports neteasetencentkugoubaidu and xiami
type Required Play type, currently supports songplaylistalbumsearch and artist
auto Optional Music address, only supports the platform in the server parameter
theme #448aff The theme color of the player defaults to #448aff
url Empty Custom music source URL, default to empty
name Empty Music name, default to empty
artist Empty Music author, default to empty
cover Empty Music cover URL, default to empty
fixed false Fixed player, default to false
mini false Display mini player, default to false
autoplay false Autoplay the music, default to false
loop all Loop playback, supports allone and nonedefault to all
order list Play order list and randomdefault to list
volume 0.7 Volume, default is 0.7
mutex true When multiple pieces of music are playing, should only the current player be turned ondefault to true
list-folded false List collapse, default is false
list-max-height 340px The maximum height of the list is 340px by default

Single playback

{{</* music theme="#2980b9" server="tencent" type="song" id="002u4ZTb0CXmJA" mini="true" */>}}

{{< music theme="#2980b9" server="tencent" type="song" id="002u4ZTb0CXmJA" mini="true" >}}

List playback

{{</* music server="netease" type="playlist" id="1982066521" list-max-height="140" */>}}

{{< music server="netease" type="playlist" id="1982066521" list-max-height="140" >}}

Customize music source

{{</* music url="/music/sky.mp3" name="Sky City" artist="Hayao Miyazaki" cover="/music/gongqijun.jpg" autoplay="true" */>}}

{{< music url="/music/sky.mp3" name="City of the Sky" artist="Hayao Miyazaki" cover="/music/gongqijun.jpg" autoplay="true" >}}