Minify's `keepComments` option doesn't work?

Following the documentation, I’ve added this to my config.toml file:

# Minification options
[minify]
    [minify.tdewolff]
        [minify.tdewolff.html]
            keepComments = true

But this does not keep the comments in the HTML rendered by Hugo. Instead those comments are simply removed, regardless of whether keepComments is true or false.

The minify library that Hugo uses doesn’t list a keepComments option (source). Is this feature perhaps removed?


hugo v0.87.0-B0C541E4+extended windows/amd64 BuildDate=2021-08-03T10:57:28Z VendorInfo=gohugoio

Solved; I found that outputting HTML comments require special syntax with safeHTML as explained here.

If I use safeHTML and keepComments together, then it does work.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.