HUGO
Menu
GitHub 87548 stars Mastodon

Hugo Gist 短代碼

使用 gist 短代碼在你的內容中嵌入 GitHub Gist。

Deprecated in v0.143.0

gist 短代碼在 0.143.0 版本中已棄用,並將在未來的版本中刪除。要在你的內容中繼續嵌入 GitHub Gists,你需要創建一個自定義短代碼:

  1. 創建新文件:在 layouts/_shortcodes 目錄中創建一個名為 gist.html 的文件。
  2. 復制源代碼:將 gist 短代碼的 原始源代碼 粘貼到新創建的 gist.html 文件中。

這將允許你在原始短代碼棄用後,繼續在內容中嵌入 GitHub Gists。

要顯示具有此 URL 的 GitHub gist:

https://gist.github.com/user/50a7482715eac222e230d1e64dd9a89b

在你的 Markdown 中包含此內容:

{{< gist user 23932424365401ffa5e9d9810102a477 >}}

要顯示 gist 中的特定文件:

{{< gist user 23932424365401ffa5e9d9810102a477 list.html >}}

Last updated: January 1, 0001
Improve this page