Skip to content

This is minimal reproducible example of Hugo compiles non deterministic output

Notifications You must be signed in to change notification settings

noreff/hugo-non-deterministic-output-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hugo compiles non deterministic output

This is minimal reproducible example of issue that I encounter while working with HUGO.

Hugo starting from version 0.63.0 start occasionally producing different output when running hugo (without changing anything).

See this gif for example:

Alt Text

I split terminal here into 2 parts Right part of the terminal (one that is separated vertically) is running watch n1 'ls -al commands in public folder. When I'm running hugo command you can see how size of the file is changed. Note that not a single file was changed. I'm just constantly running hugo and receiving different output in public folder each time.

About my use case

I'm using Hugo to generate php files.

Notes

After many rounds of testing I discover fue things:

{{ $stat :=  os.Stat ( printf "/files%v" . ) }}
{{- . -}}?{{- $stat.ModTime.Unix -}}

I know about fingerprinting and SRI available, but I'm using this partial because of the reason.

  • This doesn't happen if I don't use isPlainText = true in config.toml
[outputFormats]
  [outputFormats.PHP]
    mediaType = "application/x-php"
    baseName = "index"
    isPlainText = true
  • This doesn't happen if I have output formats other than php (If I have php and html layouts and outputs enabled everything works perfect)

About

This is minimal reproducible example of Hugo compiles non deterministic output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published