Why hugo don't build some pages randomly

I’m hugo v0.148.1+extended with my own hugo theme Arberia.

Recently I added some new pages outside contents/posts/ folder but inside contents/risorse/utility/ folder and even though I’ve correctly set the type, URL, and slug in the pages’ frontmatter. Hugo randomly doesn’t build (hugo --minify) some of them.

I’m sure hugo use single.html layout. The draft property is setted in false. Every pages have a shortcode inside a markdown index.md.
I’ve cleared the browser cache, but nothing’s changed.

Have something to suggest.

Dugajimi

Hi. I’m not a Hugo expert, just a beginner trying to help :grin:

You can try building your site with hugo --cleanDestinationDir command to remove previous build files.

Also, you can check out the new template system in GoHugo: New template system in Hugo v0.146.0. As I know, it now uses page.html instead of single.html file (but the old way should still work).

Hard to suggest anything without seeing the repository or actual code. Try building the website without minification (–minify), I had some issues before with the --minify flag.

calling hugo with some command line switches may lead to a direction:

i would remove the complete public directory, run hugo --logLevel debug --printPathWarnings --printUnusedTemplates check the result and post it.

Guessing around what your config, frontmatter, layouts, theme looks like won’t help much, so have a look at Requesting Help - Let us see your code and follow.

maybe you upgraded hugo from a pre 0.146 but did not adjust your stuff… in that case you could try a build with 0.145.0

especially the second footnote on type

1 Like

Thanks for the response, irkode, and thanks to user645235 for the suggestion.

I’ve read the document on the New Template System introduced in Hugo 0.146, but despite this, some folders are not being built. Additionally, the CSS files are not being loaded correctly.

The folder that is not being built is /Users/antedoro/Desktop/antedoro.it/content/risorse/utility. In some rare cases where a page is created, the CSS is not loaded correctly.

This is my repo:
https://github.com/antedoro/antedoro.it

Dugajimi

Try changing index.md in that directory to _index.md.

Load the page in your browser and check your browser’s developer tools to see where it tries to load the CSS from and possibly why/if it fails.

In your risorse/utility/index.md, the URL is set up as utility. If I’m not mistaken, the actual page URL will be site.com/utility/, not site.com/risorse/utility/.

Under “antedoro.it/risorse/utility/merge-pdf”, you are serving HTML that was generated by running hugo server.

Therefore, the browser tries to load the CSS from localhost:1313, and that can’t work.

The most probable cause for this is that you didn’t clean out your “public” directory before running hugo to create your website. “localhost:1313” has no business in a publicly available website.

This is intentional: I want to shorten the URL but organize the files as shown in the navbar menu: resources/utility/somepage.

I can confirm that the link to the build’s CSS remains localhost:1313 and not https://mysite.com/utility/calcolatrice.

The public/ folder was deleted before running hugo --minify. I don’t know what to do.

Perhaps start with describing what exactly you do. If you delete public, run hugo (not hugo server!) and then upload public to the directory that gets served from your HTTP server, you should not have any reference to localhost:1313 in your site.

  • Stopping hugo server -D (ctrl + C)
  • Deleting public/
  • Run hugo (no minification)

This is what have generated:
utility
┣ calcolatrice
┃ ┣ calculator-preview.png
┃ ┗ calculator.jpeg
┗ index.html

Now have not generated

unfortunately my windows box fails to checkout the theme due to a space at the end of a directory name…but

many of your pages have set draft: true in their frontmatter. no wonder the results between hugo server -D and hugo differ.

The theme and your layouts us the old 145 layouts structure. I don’t know if all that is compatible with 148.

to reduce the risk of something there I would downgrade to use 0.145.0.

usually a top-level section contains an _index.md file but your risorse does not. Might need one, but that depends on your sites layouts and theme config.

managed to repair the theme checkout and build with 0.145.0

hugo

                   | EN
-------------------+------
  Pages            | 396
  Paginator pages  |  78
  Non-page files   | 546
  Static files     | 133
  Processed images | 450
  Aliases          | 117
  Cleaned          |   0
hugo -D

                   | EN
-------------------+------
  Pages            | 423
  Paginator pages  |  84
  Non-page files   | 553
  Static files     | 133
  Processed images | 452
  Aliases          | 122
  Cleaned          |   0

using --logLevel debug --printPathWarnings --printUnusedTemplatesreports:

WARN  found no layout file for "robotstxt" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  Duplicate target paths: \categories\blog\index.html (2), \categories\blog\index.xml (2)

WARN  Template _default/404.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\_default\404.html
WARN  Template _default/_markup/render-codeblock-mermaid.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\_default\_markup\render-codeblock-mermaid.html
WARN  Template index.robotsTXT.txt is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\index.robotsTXT.txt
WARN  Template partials/clarity.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\clarity.html
WARN  Template partials/components/completed-mark.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\completed-mark.html
WARN  Template partials/components/email-subscription.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\email-subscription.html
WARN  Template partials/components/socialshareOFF.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\socialshareOFF.html
WARN  Template partials/disqus.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\disqus.html
WARN  Template partials/gridview.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\gridview.html
WARN  Template partials/guillain-barre-box.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\guillain-barre-box.html
WARN  Template partials/last-post-widget.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\last-post-widget.html
WARN  Template partials/lista2.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\lista2.html
WARN  Template partials/recentpost.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\recentpost.html
WARN  Template robots.txt is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\robots.txt
WARN  Template shortcodes/admonition.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\admonition.html
WARN  Template shortcodes/albero.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\albero.html
WARN  Template shortcodes/alert-dark.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-dark.html
WARN  Template shortcodes/alert-info.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-info.html
WARN  Template shortcodes/alert-success.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-success.html
WARN  Template shortcodes/beam-calculator.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\beam-calculator.html
WARN  Template shortcodes/calculator.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\calculator.html
WARN  Template shortcodes/compress-images.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\compress-images.html
WARN  Template shortcodes/compress-pdf.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\compress-pdf.html
WARN  Template shortcodes/faq.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\faq.html
WARN  Template shortcodes/flessotorsione.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\flessotorsione.html
WARN  Template shortcodes/image-resizer.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\image-resizer.html
WARN  Template shortcodes/inTextImg.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\inTextImg.html
WARN  Template shortcodes/list-element.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\list-element.html
WARN  Template shortcodes/merge-pdf.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\merge-pdf.html
WARN  Template shortcodes/mermaid.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\mermaid.html
WARN  Template shortcodes/playlist.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\playlist.htmlWARN  Template _default/404.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\_default\404.html
WARN  Template _default/_markup/render-codeblock-mermaid.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\_default\_markup\render-codeblock-mermaid.html
WARN  Template index.robotsTXT.txt is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\index.robotsTXT.txt
WARN  Template partials/clarity.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\clarity.html
WARN  Template partials/components/completed-mark.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\completed-mark.html
WARN  Template partials/components/email-subscription.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\email-subscription.html
WARN  Template partials/components/socialshareOFF.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\components\socialshareOFF.html
WARN  Template partials/disqus.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\disqus.html
WARN  Template partials/gridview.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\gridview.html
WARN  Template partials/guillain-barre-box.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\partials\guillain-barre-box.html
WARN  Template partials/last-post-widget.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\last-post-widget.html
WARN  Template partials/lista2.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\lista2.html
WARN  Template partials/recentpost.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\partials\recentpost.html
WARN  Template robots.txt is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\robots.txt
WARN  Template shortcodes/admonition.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\admonition.html
WARN  Template shortcodes/albero.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\albero.html
WARN  Template shortcodes/alert-dark.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-dark.html
WARN  Template shortcodes/alert-info.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-info.html
WARN  Template shortcodes/alert-success.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\alert-success.html
WARN  Template shortcodes/beam-calculator.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\beam-calculator.html
WARN  Template shortcodes/calculator.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\calculator.html
WARN  Template shortcodes/compress-images.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\compress-images.html
WARN  Template shortcodes/compress-pdf.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\compress-pdf.html
WARN  Template shortcodes/faq.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\faq.html
WARN  Template shortcodes/flessotorsione.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\flessotorsione.html
WARN  Template shortcodes/image-resizer.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\image-resizer.html
WARN  Template shortcodes/inTextImg.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\inTextImg.html
WARN  Template shortcodes/list-element.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\list-element.html
WARN  Template shortcodes/merge-pdf.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\layouts\shortcodes\merge-pdf.html
WARN  Template shortcodes/mermaid.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\mermaid.html
WARN  Template shortcodes/playlist.html is unused, source file C:\_repos\github\clone\topic-55910-missingPages\themes\arberia\layouts\shortcodes\playlist.html

If there’s anything missing, please be more precise on what you are missing.

  1. I’ve updated Hugo to the latest version (hugo v0.150.0+extended+).
  2. I’ve also installed version hugo v0.145.0 anyway.

This way, I can test with both Hugo versions.

My Tests (in order)

  1. Build antedoro.it with hugo v0.145.0 → The problems persist.
  2. Update my Arberia theme following the New Template System guidelines from New template system in Hugo v0.146.0 .
  3. Build the site with hugo v0.150.0 → The problems remain.

Summary of Problems:
The HTML files gemerated in /public/utility have links like http://localhost:1313/ instead of, for example, https://example.com/.

At this point, I think there’s a configuration problem in config.

Please If you make some test update arberia theme

This can only happen if you create them with hugo server. We’ve been over that. Do a rm -rf public and then hugo, not hugo server.

OTOH, I see for example

frontmatter.json:  "frontMatter.preview.host": "http://localhost:1313",

This localhost:1313 has no business in your md files. Nor anywhere.

i use

hugo --minify --environment production

Last idea: Do you have an environment variable HUGO_BASEURL? If so, what is it set to?
Do a hugo config | grep -i baseurl, too

hugo config | grep -i baseurl give
baseurl = ‘http://localhost:1313

But is expected because the structure of config file:
:open_file_folder:_default
┃ ┣ :scroll:config.toml → baseurl = ‘https://antedoro.it
┃ ┣ :scroll:menus.toml
┃ ┗ :scroll:params.toml
:open_file_folder:development
:scroll:config.toml → baseURL = “http://localhost:1313

Remove that. There’s no need to set baseurl ever to anything but the your public site URL. And make sure that you don’t have the environment variable set.

Removed development folder
hugo --minify
and now generate only this:

:open_file_folder:calcolatrice
┃ ┣ :scroll:calculator-preview.png
┃ ┗ :scroll:calculator.jpeg
:scroll:index.html

Missing other folder with index.html file

that means more precise?