MENU

Hugo 的 shortcodes 记录

October 4, 2018 • Read: 59 • 笔记•记录

本文若有失效或者错误内容请留言或者通过其他方式联系我,尽可能及时更新。

欢迎关注不怎么更新的 TG 频道


Hugo 内置

# gist
{{< gist username project_name >}}
{{<  gist username project_name filename >}}  //  若一个gist有多段代码,可以在后面加上filename

# instagram /tweet
{{< instagram/tweet  post_id >}}

# youtube
{{< youtube video_id >}}  // Positional
{{< youtube id="video_id" autoplay="true" >}} // Named

主题内置

fancybox

Fancybox is a jQuery lightbox script for displaying images, videos and more. It is touch enabled, responsive and fully customizable.

  • Named

< fancybox path="path" file="file" caption="caption" gallery="gallery" >

  • Positional

< fancybox "path" "file" "caption" "gallery" >

img-post

Add an image which can be aligned center, left, or right.

  • Named

< img-post path="date" file="filename.jpg" alt="Alt Text" type="left" >

  • Positional

< img-post "title" "filename.jpg" "Alt Text" "left" >

img-fit

Insert multiple images with the ability to create a gallery if needed.

< img-fit
    "4u" "filename1.jpg" "Alt text 1"
    "4u" "filename2.jpg" "Alt text 2"
    "4u$" "filename3.jpg" "Alt text 3"
    "date" >

注意:由于build的时候会直接将shortcodes结果产生,所以主题内置内容均省略了必需的符号,使用符号见Hugo 内置的示例。


> 本文链接:https://10101.io/2018/10/04/hugo-shortcodes
> 本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可,转载请注明出处。

Last Modified: October 8, 2019
Archives QR Code Tip
QR Code for this page
Tipping QR Code