Solitude Docs
内容写作

Shortcodes

使用 Solitude 随附的 Hugo 原生 Shortcodes。

语法

Solitude 提供丰富内容所需的 Hugo Shortcodes。请使用 Hugo 边界符,不要继续使用 Hexo 标签语法:

{{</* note type="info" */>}}
这里支持 Markdown。
{{</* /note */>}}

{{</* button url="https://gohugo.io/" text="Hugo" icon="fas fa-link" */>}}

组件包括文本与标签(pspanlabel)、提示(notesubnotefold)、链接与媒体(buttonlinkimgaudiovideo)、结构化内容(tabstimelinegalleryseries)以及动态内容(mermaidchartjstypeit)。

使用规则

  • 名称和参数区分大小写。
  • 块级 Shortcode 必须成对闭合。
  • exampleSite/content/posts/shortcodes.md 作为可构建参考。
  • 使用可选动态组件前,先启用对应的 mermaidcharttypeitkatex 配置。

迁移文章时,应把每一个 {% ... %} Hexo 标签替换为对应 Hugo Shortcode,并运行生产构建检查不完整的标签对。