Hugo Shortcode 渲染外部代码和文件
有时在我的文章中会包含代码块(例如,javascript);一个直接的方法是将代码直接复制到相应的markdown文件中。
然而,由于将来可能会更新这段代码,但仍然希望我的博客文章显示最新的版本。 有时在多篇文章中引用同一个代码块,更新的时候就比较麻烦,需要复制粘贴多次。
有时在我的文章中会包含代码块(例如,javascript);一个直接的方法是将代码直接复制到相应的markdown文件中。
然而,由于将来可能会更新这段代码,但仍然希望我的博客文章显示最新的版本。 有时在多篇文章中引用同一个代码块,更新的时候就比较麻烦,需要复制粘贴多次。
shortcodes
目录cd your_theme_dir
mkdir layouts/shortcodes
mermaid.html
文件cd shortcodes
touch mermaid.html
shortcode的名字就是mermaid
;该文件名与我们要使用的shortcode
名称相同。将以下内容粘贴到该文件中。
Gitalk
is a comment plug based on Github issue api.
Hugo
can compile the Markdown files with themes and templates into static web files, such as CSS, HTML and JavaScript.
To use Gitalk
in the Hugo
blog, we need to add Gitalk related code as <div>
into the HTML template.
Then update the config.toml for Gitalk
.
Hugo
has many template params for the blog web page. There are two which are related to word count of articles.
There is an interesting api on https://ghchart.rshah.org/
It can display your Github chart information as an image.