One of GoHugo’s problems is, that the focus is mostly on speed. Simple HTML rules are prone to be ignored or freely interpreted (for instance, in the internal templates). But it offers ways to override and configure things, so not all is lost.
One of GoHugo’s problems is, that the focus is mostly on speed. Simple HTML rules are prone to be ignored or freely interpreted (for instance, in the internal templates). But it offers ways to override and configure things, so not all is lost.
Hugo 0.96.0was published last weekend with two new features and many smaller changes and fixes under the hood. Here is a quick overview of the release. New features Vertical merging of content mounts Under this title hides a useful feature for Hugo Modules that mount content directories.
Hugo 0.95.0brings some really useful features (next to smaller speed increases as always) and upgrades the used Golang version to 1.18. New feature: {{ break }} and {{ continue }} break and continue are keywords known to developers of any programming language.
I needed a Hugo shortcode to show a list of posts that belonged to a certain tag, which is quite easy. Add the following to layouts/shortcodes/taglist.html
or whatever name you like to use for the shortcode.
Some days ago I realised, that I keep all my configurations for GoHugo in the TOML format, while using YAML for the frontmatters in my content folder. That did not seem right ;) so I changed those too to TOML.
Golangs $date.Format is unable to add ordinal suffixes to dates (like 1st, 2nd, 3rd, 4th). Let’s not judge Golang for that. The following is how I remedy this issue: layouts/partials/func/formatOrdinalDate.html 1{{-$format:=.format-}} 2{{-$date:=.date-}} 3{{-$shortened:="th"-}} 4{{-ifin(slice12131)$date.Day-}} 5{{-$shortened="st"-}} 6{{-elseifin(slice222)$date.Day-}} 7{{-$shortened="and"-}} 8{{-elseifin(slice323)$date.Day-}} 9{{-$shortened="rd"-}} 10{{-end}} 11{{-return$date.
If you are using the code styling functionality of GoHugo then you might have stumbled over a common issue when you are using Content Security Policies (CSP) and inline styles. Using CSPs is the proper way these days to secure your site code but it is considered (in the realm of CSPs) bad style to have your style sheets or JavaScript inlined into your page.
Giscusis a new star on the comment systems for static website generators orbit. It is inspired by the wonderful utterancesand uses Github Discussions to save comments. It’s open source, easily configurable, themeable, translatable, and you can host it on your own server(it’s JavaScript based) if you like.