HUGO

Finding out what happens

Occasionally I run into the situation that pages are ignored, not rendered, or rendered with unexpected results.

Is there some debugging option to make hugo show what it is doing, e.g. what pages it sees, what templates it applies and so on?

There are a couple of options you have in Hugo:

  • You can use the --debug flag with the CLI, which would output debug messages on your console. Check Hugo docs for CLI - https://gohugo.io/commands/hugo/
  • You may want to add some snippets that would print some intermediate results for you. Check this documentation for details - https://gohugo.io/templates/template-debugging/
    Try these and see if it benefits you with what you are looking for.

This is what I tried in the first place. But the only information debug prints is:

INFO 2020/06/06 16:46:39 No translation bundle found for default language "en"
INFO 2020/06/06 16:46:39 Translation func for language en not found, use default.
INFO 2020/06/06 16:46:39 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2020/06/06 16:46:40 Using config file: 
Building sites … INFO 2020/06/06 16:46:40 syncing static files to /bulk/tmp/quickstart/public/
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config
DEBUG 2020/06/06 16:46:40 found menu: "main", in site config

This is not really helpful. E.g. it announces config file processing but doesn’t even tell what config files.
Maybe I need some other settings to get more debug?

Adding prints can be useful but require that your files are processed. It does not help finding out why a specific content document is not processed, or what templates are involved. Runtime errors also prevent documents from being processed, so print doesn’t help in this case.