HUGO

Build Output Is Indeterministic

What Hugo shows running as a server and what it builds into the public directory are sometimes different, that is, Hugo’s build is indeterministic.

See this video for a demonstration.

Since it sometimes does exactly what I want, and sometimes does not, I do not think it has to do with any configuration; but, below is my config.toml anyway.

baseURL      = "https://xphyro.github.io"
languageCode = "en"
title        = "XPhyro's Blog"
theme        = "hello-friend-ng"
PygmentsCodeFences = true
PygmentsStyle = "monokai"
paginate  = 100
rssLimit  = 100  
copyright = "This work is licensed under CC BY-NC-SA 4.0." 
archetypeDir = "archetypes"
contentDir   = "content"
dataDir      = "data"
layoutDir    = "layouts"
publishDir   = "public"
canonifyURLs = true
enableRobotsTXT = true
enableGitInfo   = false
enableEmoji     = true
enableMissingTranslationPlaceholders = false
disableRSS     = false
disableSitemap = false
disable404     = false
disableHugoGeneratorInject = false
[permalinks]
  posts = "/posts/:year/:month/:day/:filename"
[author]
  name = "Berke Kocaoğlu"
[blackfriday]
  hrefTargetBlank = true
[taxonomies]
  posts    = "posts"
  tag      = "tags"
  category = "categories"
  series   = "series"
[params]
  dateform        = "Jan 2, 2006"
  dateformShort   = "Jan 2"
  dateformNum     = "2006-01-02"
  dateformNumTime = "2006-01-02 15:04"
  description = ""
  keywords = ""
  images = [""]
  homeSubtitle = ""
  contentTypeName = "content/posts"
  disableReadOtherPosts = false
  enableThemeToggle = true
  defaultTheme = "dark"
  enableSharingButtons = false
  customCSS = ["/style.css"]
  customJS  = []
  [params.footer]
    trademark = true
    rss = true
    copyright = true
    author = true
    topText = []
    bottomText = [
    ]
  [params.favicon.color]
    mask = "#1b1c1d"
    msapplication = "#1b1c1d"
    theme = "#1b1c1d"
  [params.logo]
    logoMark     = ">"
    logoText     = "XPhyro's Blog"
    logoHomeLink = "/"
    logoCursorDisabled = true
  [[params.social]]
    name = "email"
    url = "mailto:berke.kocaoglu@metu.edu.tr"
  [[params.social]]
    name = "github"
    url = "https://github.com/XPhyro"
[languages]
  [languages.en]
    subtitle  = ""
    weight    = 1
    copyright = '<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="noopener">CC BY-NC-SA 4.0</a> & <a href="https://opensource.org/licenses/MIT" target="_blank" rel="noopener">MIT</a>'
[menu]
  [[menu.main]]
    identifier = "posts"
    name       = "Posts"
    url        = "/posts"
    weight     = 20
  [[menu.main]]
    identifier = "tags"
    name       = "Tags"
    url        = "/tags"
    weight     = 30
  [[menu.main]]
    identifier = "categories"
    name       = "Categories"
    url        = "/categories"
    weight     = 40
  [[menu.main]]
    identifier = "series"
    name       = "Series"
    url        = "/series"
    weight     = 50
  [[menu.main]]
    identifier = "about"
    name       = "About"
    url        = "/about"
    weight     = 200
[markup]
  [markup.tableOfContents]
    startLevel = 1

There are two different states of the index.html and index.xml files in the video. One of these contains the posts, the other one does not. In the local server deployed via hugo server, index.html always contains the posts, supporting my hypothesis that this is not a configuration issue.

If you navigate to https://xphyro.github.io/posts, you will see that there are no posts. But, you can reach the post that was supposed to be there via navigating to https://xphyro.github.io/posts/2021/07/15/hugo-setup. You can also reach this post from the tags, categories or series menus. On top of this, Hugo sometimes (about half of the time) correctly builds the site and shows that post there.

I believe this is not an issue related to themes. I also tested with the Ananke theme, which is the endorsed theme in the quick start guide, and the behaviour is the same.

Both version 0.85.0-1 on the Arch Linux repository and the manual build as of the commit 022c4795510306e08a4aba31504ca382d41c7fac yield the aforementioned results.

Below are the outputs of hugo version and uname -a

hugo v0.85.0+extended linux/amd64 BuildDate=unknown
Linux archlinux 5.10.49-1-lts #1 SMP Sun, 11 Jul 2021 12:21:22 +0000 x86_64 GNU/Linux

Is this a bug on Hugo’s end, or a problem with my configuration? Should I submit a bug report on GitHub?

impossible for me to say without seeing the actual site, but based on my wast experience, my best guess is that you have several resources with the same target on disk. What you see is parallelism in play. You can debug this with the --path-warnings flag.

1 Like

Indeed, the problem was as you described. Removing

[taxonomies]
  posts = "posts"

got rid of the warnings.

Thanks!

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