Linux Hugo for Ubuntu renders one page less than Windows version from mounted folder

Now it hit me with a strange OS related issue:

See the logs at end of the post

Source is here: code at: GitHub - irkode/hugo-forum: just a playground for topics from the Discurse Hugo froum and

Generates 4 pages on

  • GitHub runner Ubuntu-latest
  • local WSL installation on Windows. - also Ubuntu

Generates 5 pages on

  • GitHub runner Windows (2019)
  • local Windows 11

The missing page

  • mounted from /examples/.../index.md to a section in /content/examples
    source: /examples/bare-metal-website/content/index.md
    should be generated to: /public/examples/bare-metal-website/index.html

  • Permalinks adjusted to omit the content folder. '/examples' = '/:sections/:slug'

and the logfiles below with different outputs.

baseURL = "https://irkode.github.io/hugo-forum/"
defaultContentLanguage = "en"
title = "Forum Example"

disableKinds = ['RSS', 'sitemap', 'taxonomy', 'term']

[permalinks]
   [permalinks.page]
      '/examples' = '/:sections/:slug'

[module]
   # workaround for -cleanDestinationDir without having need for a static folder: https://github.com/gohugoio/hugo/issues/8433
   [[module.mounts]]
      target = 'static'
      source = 'static'
      excludeFiles = [".keep"]

   [[module.mounts]]
      source = "content"
      target = "content"
   [[module.mounts]]
      source = "/examples"
      target = "content/examples"
      includeFiles = ["/**/_index.md","/**/index.md"]

looks like there’s a different behavior for these systems

  • The windows version gives a DEBUG output about the Permalink mapping
  • the Ubuntu run does not, but warns about an unused template
    which is exactly the template that should render the page

no CSS and WEBP used, so I guess the difference there is not important
Windows:

hugo v0.125.6-69ede10edcd539380914bbee58d4d32953dd8b43+extended windows/amd64 BuildDate=2024-05-05T10:52:52Z VendorInfo=gohugoio
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.22.2"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"

Start building sites …
hugo v0.125.6-69ede10edcd539380914bbee58d4d32953dd8b43+extended windows/amd64 BuildDate=2024-05-05T10:52:52Z VendorInfo=gohugoio

INFO  static: removing all files from destination that don't exist in static dirs
INFO  static: syncing static files to \ duration 0s
INFO  build:  step process substep collect files 7 files_total 7 duration 0s
INFO  build:  step process duration 0s
DEBUG Set expanded permalink path for page examples\bare-metal-website\content\index.md to "//examples/bare-metal-website/"
INFO  build:  step assemble duration 0s
INFO  build:  step render substep pages site en outputFormat html duration 10.1186ms
INFO  build:  step render pages 5 content 5 duration 10.1186ms
INFO  build:  step postProcess duration 0s
INFO  build:  duration 10.1186ms

                   | EN
-------------------+-----
  Pages            |  5
  Paginator pages  |  0
  Non-page files   |  1
  Static files     |  0
  Processed images |  0
  Aliases          |  0
  Cleaned          |  0

Total in 15 ms

WSL Ubuntu:

hugo v0.125.6-69ede10edcd539380914bbee58d4d32953dd8b43+extended linux/amd64 BuildDate=2024-05-05T10:52:52Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.22.2"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"

Start building sites …
hugo v0.125.6-69ede10edcd539380914bbee58d4d32953dd8b43+extended linux/amd64 BuildDate=2024-05-05T10:52:52Z VendorInfo=gohugoio

INFO  static: removing all files from destination that don't exist in static dirs
INFO  static: syncing static files to / duration 294.73µs
INFO  build:  step process substep collect files 5 files_total 5 duration 545.599µs
INFO  build:  step process duration 627.955µs
INFO  build:  step assemble duration 228.935µs
INFO  build:  step render substep pages site en outputFormat html duration 4.228275ms
INFO  build:  step render pages 4 content 4 duration 4.881566ms
WARN  Template examples/single-baseof.html is unused, source file /home/rik/github/hugo-forum/layouts/examples/single-baseof.html
INFO  build:  step postProcess duration 3.717µs
INFO  build:  duration 5.928086ms

                   | EN
-------------------+-----
  Pages            |  4
  Paginator pages  |  0
  Non-page files   |  1
  Static files     |  0
  Processed images |  0
  Aliases          |  0
  Cleaned          |  0

Total in 11 ms

Can you reproduce the problem with v0.122.0 (i.e., is this something that’s been a problem for a while?).

Do you get the same results if you remove this?

includeFiles = ["/**/_index.md","/**/index.md"]

Please confirm that you are missing a page, and that this is not simply a reporting error.

Confirmed. The page is not there but expected.

Swichted ubuntu runner to 122.0 and same . Page missing

Will do further tests later. Currently only mobile

Maybe the go version?

I would say that’s very unlikely. More testing would be appreciated.

Windows 122.0 :

Start building sites …
hugo v0.122.0-b9a03bd59d5f71a529acb3e33f995e0ef332b3aa+extended windows/amd64 BuildDate=2024-01-26T15:54:24Z VendorInfo=gohugoio

INFO  copy static: removing all files from destination that don't exist in static dirs
INFO  copy static: syncing static files to \
INFO  build: running step "process" duration "2.5857ms"
INFO  build: running step "assemble" duration "18.1126ms"
DEBUG Set expanded permalink path for page examples\bare-metal-website\content\index.md to "/examples/bare-metal-website/"
WARN  .Path when the page is backed by a file is deprecated. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:
  {{ $path := "" }}
  {{ with .File }}
        {{ $path = .Path }}
  {{ else }}
        {{ $path = .Path }}
  {{ end }}
INFO  build: running step "render" duration "11.3018ms"
WARN  Duplicate target paths: \examples\bare-metal-website\index.html (2)
INFO  build: running step "postProcess" duration "0s"

                   | EN
-------------------+-----
  Pages            |  6

fixed the deprecation and it still reports 6 Pages - but only 5 there. looks like there’s a problem with the section listing here:

  • /public/examples/
    #### _default/baseof.html
    
    #### examples/section.html
    
    # Examples subsection listing     <--  content from /examples/_index.md
    * [/hugo-forum/examples/bare-metal-website/](http://localhost:1313/hugo-forum/examples/bare-metal-website/)
    
  • /public/examples/bare-metal-website/
    #### _default/baseof.html
    
    #### examples/section.html
                                                            <-- NO content here supposedly from /examples/bare-metal-website/index_md
    * [/hugo-forum/examples/bare-metal-website/](http://localhost:1313/hugo-forum/examples/bare-metal-website/)
    
  • /examples/bare-metal-website/index_md
---
build:
   list: always
   publishResources: false
   render: never
---

deprecation warning was also there in Ubuntu version.

so we still have inconsitant behavior with 122.0:

this time one page more is rendered (the listing) which overwrites(?) the page

  • guess it’s in my folder structure and the mounts and headless logic

will dig into and come back

OK, here’s the problem. Hugo on Windows is misbehaving, while Hugo on Linux is doing the right thing.

[[module.mounts]]
source = "/examples"
target = "content/examples"

With a leading slash, the source path is relative to the system root.

Linux is doing the right thing here. It can’t find /examples in the system root so nothing is mounted.

Windows, for some reason, finds /examples in the project root, and it shouldn’t because it is a system-relative path.

If you change your site configuration to this…

[[module.mounts]]
source = "examples"   # no leading slash
target = "content/examples"

… you get the same results on both platforms:

public/
├── articles/
│   ├── bare-metal-website/
│   │   ├── images/
│   │   │   └── bare-metal-website.png
│   │   └── index.html
│   └── index.html
├── examples/
│   ├── bare-metal-website/
│   │   └── index.html
│   └── index.html
└── index.html

This test can be reduced to:

content/
└── p1.md
content-other/
└── p2.md
[[module.mounts]]
source = "content"
target = "content"

[[module.mounts]]
source = "/content-other"  # Neither Linux nor Windows should render p2
target = "content"

And yes, this is a bug:
https://github.com/gohugoio/hugo/issues/12470

1 Like

g’evening Joe,

I was still preparing the even more bare example as I could not catch it.

thx again for your competent, accurate and very fast investigation and solution.
always a pleasure.

thx for your time and patience.

1 Like

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