We have installed a theme called Beautiful Hugo, now let’s get the most out of it!
- Syntax highlighting
- Disqus support
- Google Analytics
- Commit SHA on the footer
To take advantage of this feature we don’t need to do anything. The theme is responsive out of the box. It looks great on small devices and big ones too.
Syntax highlighting can be very useful if you write a blog about programming. Beautiful Hugo comes with server side and client side syntax highlighting.
Use triple backticks (
``` ) or triple tilde (
~~~ ) around code blocks.
Client side highlighting does not require pygments to be installed.
$ pip install Pygments
pygmentsuseclasses = trueto the
config.tomlfile on your root directory.
To start using disqus for your comments, create an account on the disqus website and then uncomment and fill out the
disqusShortname parameter in
To add Google Analytics you need to get your tracking ID from your Google Analytics account, then add it to the
googleAnalytics parameter in
Commit SHA on the footer
In words of the author:
If the source of your site is in a Git repo, the SHA corresponding to the commit the site is built from can be shown on the footer.
To do so, two environment variables have to be set (
GIT_COMMIT_SHA_SHORT) and parameter commit has to be defined in the config file:
[Params] commit = “https://github.com/
This can be achieved by running the next command prior to calling Hugo:
git rev-parse --verify HEADGIT_COMMIT_SHA_SHORT=
git rev-parse --short HEAD
See at xor-gate/xor-gate.org an example of how to add it to a continuous integration system.
MIT Licensed, see license.