gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.5k stars 7.44k forks source link

Page is not rendered randomly(!) #12499

Open knutov opened 3 months ago

knutov commented 3 months ago
$ hugo version
hugo v0.126.1-3d40aba512931031921463dafc172c0d124437b8+extended (from snap)
hugo v0.126.1+extended linux/amd64 BuildDate=2024-05-15T10:42:34Z VendorInfo=brew

but I have the same problem with all versions after 0.122.

One page of my site randomly is not rendered by hugo. I mean I can run multiple times this command:

hugo -v --cleanDestinationDir &&  ls -la ./public/directions/index.xml

and sometimes file is present, some times it is not. At the same time file ./public/directions/index.html always exists, but main template block is empty i this file. Page counter is 1 page less when file is not rendered.

Everething is fine with

hugo v0.122.0-b9a03bd59d5f71a529acb3e33f995e0ef332b3aa linux/amd64 BuildDate=2024-01-26T15:54:24Z VendorInfo=gohugoio

but any newer version from releases page, starting from

hugo v0.123.0-3c8a4713908e48e6523f058ca126710397aa4ed5 linux/amd64 BuildDate=2024-02-19T16:32:38Z VendorInfo=gohugoio

is broken.

Thre is nothing special in template for this page, it only contains few blocks like

        {{ .Scratch.Set "block_title" "..." }}
        {{ .Scratch.Set "block_class" "..." }}
        {{ partial "block-direction" . }}
jmooring commented 3 months ago

There's not much to go on here. Can you provide a minimal example?

knutov commented 3 months ago

There's not much to go on here. Can you provide a minimal example?

unfortunately I can not open the code of all site. It looks like the problem is only on page with partials and using .Scratch - is there anything related in changes at 0.123.0?

It will not be easy to minify the code to make the minimal reproducer, is there any better/simpler option?

bep commented 3 months ago

is there anything related in changes at 0.123.0?

It's impossible for us to say with so little information.

knutov commented 3 weeks ago

Just for the record - the problem still exists with the latest 0.131 version.

I also found sitemaps are not rendered (compared to 0.122).

I hope I'll find the time to create minimal reproducer next week.

knutov commented 3 weeks ago

@bep btw, is there some way to open original repo privately to only you to debug this case?

knutov commented 3 weeks ago

looks like sitemap change connected with https://github.com/gohugoio/hugo/issues/12183

with 0.122 I have this stats after rendering:

                   | RU   
-------------------+------
  Pages            | 119  
  Paginator pages  |   0  
  Non-page files   |   0  
  Static files     | 443  
  Processed images |   0  
  Aliases          |  63  
  Sitemaps         |   1  
  Cleaned          |   0  

with 0.131:

                   | RU   
-------------------+------
  Pages            | 118   <---- or 119 - one page is still missing sometimes
  Paginator pages  |   0  
  Non-page files   |   0  
  Static files     | 443  
  Processed images |   0  
  Aliases          |  63   <---- no sitemap after this string
  Cleaned          |   0 
knutov commented 3 weeks ago

Well, I did minimal reproducer and added (new option?) --printPathWarnings so I found this:

WARN  Duplicate content path: "/directions" file: ".../content/directions/_index.md" file: ".../content/directions.html"

Well, it's definitely looks like error, so why it is not error when run just with --logLevel debug ?

Why did this always work before with 0.122 and earlier?

bep commented 3 weeks ago

Why did this always work before with 0.122 and earlier?

0.123 was a full rewrite of how we process content files. We still do sorting of the input files, and I'm not sure why you see the randomness you see, but for me this looks like you have both a section page and a regular page having the same content path.

Note that we now potentially can get content from many sources (markdown files, content adapters) and it's very hard to determine for us what's considered "errors" in this situation.

knutov commented 3 weeks ago

both a section page and a regular page having the same content path

yes, removing regular page (was duplicate by mistake) solved the problem.

May be --printPathWarnings shoud be the default behavior, otherwise it's hard to guess to add this option to find the mistake.