cljoly/gohugo-asciinema

Min Hugo Version: 0.77.0

Insert the Asciinema player in your Hugo site with ease.

Install

If you haven’t used hugo modules before (you need the go compiler):

hugo mod init <my-module-path>

more details in hugo docs.

Then just:

hugo mod get -u -v cj.rs/gohugo-asciinema

and edit your hugo config, for instance for config.toml

[module]
  [[module.imports]]
    path = "cj.rs/gohugo-asciinema"

Use

Use this shortcode:

{{< asciicast src="/telescope-repo-nvim/telescope.json" poster="npt:0:04" autoplay="true" loop="true" >}}

Note: src is known to sometimes cause problem with relative URLs. Your best bet is to use absolute URLs or at least from the root of the site, as in the above example.

Features

  • Displays a message when JavaScript is disabled in the user browser
  • Fingerprinted assets, to improve caching and ultimately your site performance
  • Update with hugo mod get -u cj.rs/gohugo-asciinema

Contribute

You may use a local version of this module in hugo like this:

[module]
replacements = "cj.rs/gohugo-asciinema -> /some/path/gohugo-asciinema"
[[module.imports]]
path = "cj.rs/gohugo-asciinema"

Please consider sending a PR with your patches, it’s always appreciated and will save you the trouble of maintaining the changes on your own!