implements the first part, working for configured variants; for that, loading of stylesheets was overhauled by now merging all configured variants into one big stylesheet for each output format and loading this instead of one stylesheet per configured variant; previously @media print styles were applied on top of @media screen styles; this is now strictly isolated, which doesn't require styles like neon to revert styles for print anymore; this change was also used to implement the minify parameter, to shrink those generated stylesheets, making them shrink to 66% of their unminified size for the exampleSite; the theme switcher functionality is now completely independend of variant.js; the switch is now handled by in-page javascript which avoids waiting for external scripts to load, so switching can happen as early as possible; switching of themes is now implemented by just setting a data attribute to the html element, were previously a complex mechanism of dynamically loading of variant CSS files was implemented; the call for variant.js was removed in this changeset, making the generator broken and useless; this will be fixed with the next patch;
2.1 KiB
+++ categories = ["howto"] description = "How to make your generated HTML output stable" options = ["disableAssetsBusting", "disableGeneratorVersion", "disableRandomIds", "minify"] title = "Stable Output" weight = 6 +++
Disabling the Generator Meta
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} The theme adds a meta tag with its version number to each page.
This isn't a security risk and helps us support you better.
To turn this off, set disableGeneratorVersion=true
.
{{< multiconfig file=hugo >}} [params] disableGeneratorVersion = true {{< /multiconfig >}}
If you also want to turn off Hugo's version meta tag, use disableHugoGeneratorInject=true
.
Disabling IDs for Referenced Assets
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} The theme creates a unique ID for each build and adds it to each referenced asset's URL to make browsers not keep outdated cached assets.
This is good for production sites but can be problematic during development. It makes comparing outputs difficult as each build has new IDs.
To disable this, set disableAssetsBusting=true
.
{{< multiconfig file=hugo >}} [params] disableAssetsBusting = true {{< /multiconfig >}}
Disabling IDs for Interactive HTML Elements
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} Features like expanders, callouts, and tabs use unique IDs to work. These IDs change with each build.
This is necessary for the theme to work properly, but it can make comparing outputs between builds difficult.
To turn this off, set disableRandomIds=true
. Note, that this will result in a non-functional site!.
{{< multiconfig file=hugo >}} [params] disableRandomIds = true {{< /multiconfig >}}
Disabling Assets Minification
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} If minify=true
, further theme assets will be minified during build. If no value is set, the theme will avoid minification if you have started with hugo server
and otherwise will minify.
{{< multiconfig file=hugo >}} [params] minify = false {{< /multiconfig >}}