Fails to compile after upgrade to 0.32

Hi tried to upgrade to Hugo 0.32.2 (starting on 0.18.0). This failed so I took it in steps. Solved few tiny things along the way and got to the major problem, it’s between 0.31.0 and 0.32.2.

The error printed is:

ERROR 2018/01/07 11:52:17 Error while rendering "page" in "post/": template: post/single.html:1:3: executing "post/single.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found

I have a theme installed (hyde-x) which provides a post layout (themes/hyde-x/layouts/post/single.html) which includes partials (theme/hyde-x/layouts/partials/head.html, theme/hyde-x/layouts/partials/foot.html, theme/hyde-x/layouts/partials/sidebar.html). The layout is overwritten in layouts/post/single.html but still includes the partials for head, foot and sidebar. Foot and sidebar partials are also overwritten (layouts/partials/foot.html and layouts/partials/sidebar.html). Head partial is not overwritten. Up to 0.31 the partial from the theme was being included - that’s desired and expected. In 0.32.2 it fails with the error above.

Am I doing something wrong, do I need to configure something or is this a bug?

I suspect there are some other warnings/errors in the log?

There are, but don’t seem relevant:

./hugo322  -v -b test.com
INFO 2018/01/07 14:03:24 Using config file: /home/mingan/html/developing/config.toml
Building sites … INFO 2018/01/07 14:03:24 syncing static files to /home/mingan/html/developing/public/
INFO 2018/01/07 14:03:24 found taxonomies: map[string]string{"category":"categories"}
ERROR 2018/01/07 14:03:24 Error while rendering "page" in "post/": template: post/single.html:1:3: executing "post/single.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found

Serve is more chatty:

./hugo322  -v -b test.com serve
INFO 2018/01/07 14:03:42 Using config file: /home/mingan/html/developing/config.toml
Building sites … INFO 2018/01/07 14:03:42 syncing static files to /
INFO 2018/01/07 14:03:43 found taxonomies: map[string]string{"category":"categories"}
ERROR 2018/01/07 14:03:43 Error while rendering "page" in "post/": template: post/single.html:1:3: executing "post/single.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found
WARN 2018/01/07 14:03:43 template: post/single.html:1:3: executing "post/single.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found
WARN 2018/01/07 14:03:43 [en] Unable to locate layout for "home": [index.en.html.html index.html.html index.en.html index.html _default/list.en.html.html _default/list.html.html _default/list.en.html _default/list.html theme/index.en.html.html theme/index.html.html theme/index.en.html theme/index.html theme/_default/list.en.html.html theme/_default/list.html.html theme/_default/list.en.html theme/_default/list.html]
WARN 2018/01/07 14:03:43 [en] Unable to locate layout for "taxonomy": [taxonomy/category.en.html.html taxonomy/category.html.html taxonomy/category.en.html taxonomy/category.html indexes/category.en.html.html indexes/category.html.html indexes/category.en.html indexes/category.html _default/taxonomy.en.html.html _default/taxonomy.html.html _default/taxonomy.en.html _default/taxonomy.html _default/list.en.html.html _default/list.html.html _default/list.en.html _default/list.html theme/taxonomy/category.en.html.html theme/taxonomy/category.html.html theme/taxonomy/category.en.html theme/taxonomy/category.html theme/indexes/category.en.html.html theme/indexes/category.html.html theme/indexes/category.en.html theme/indexes/category.html theme/_default/taxonomy.en.html.html theme/_default/taxonomy.html.html theme/_default/taxonomy.en.html theme/_default/taxonomy.html theme/_default/list.en.html.html theme/_default/list.html.html theme/_default/list.en.html theme/_default/list.html]
WARN 2018/01/07 14:03:43 [en] Unable to locate layout for "section": [section/post.en.html.html section/post.html.html section/post.en.html section/post.html post/list.en.html.html post/list.html.html post/list.en.html post/list.html _default/section.en.html.html _default/section.html.html _default/section.en.html _default/section.html _default/list.en.html.html _default/list.html.html _default/list.en.html _default/list.html indexes/post.en.html.html indexes/post.html.html indexes/post.en.html indexes/post.html _default/indexes.en.html.html _default/indexes.html.html _default/indexes.en.html _default/indexes.html theme/section/post.en.html.html theme/section/post.html.html theme/section/post.en.html theme/section/post.html theme/post/list.en.html.html theme/post/list.html.html theme/post/list.en.html theme/post/list.html theme/_default/section.en.html.html theme/_default/section.html.html theme/_default/section.en.html theme/_default/section.html theme/_default/list.en.html.html theme/_default/list.html.html theme/_default/list.en.html theme/_default/list.html theme/indexes/post.en.html.html theme/indexes/post.html.html theme/indexes/post.en.html theme/indexes/post.html theme/_default/indexes.en.html.html theme/_default/indexes.html.html theme/_default/indexes.en.html theme/_default/indexes.html]
WARN 2018/01/07 14:03:43 [en] Unable to locate layout for "404": [404.html theme/404.html]

OK,

It is impossible to tell from the little information you have given what’s happening.

If you want us to help, post a link to the failing source.

I’ve got the same problem; I’m on the snap so it’s pulled it in automatically. Behaviour with evaluating partials has changed somewhere.

My error is very similar (and I’m also using a variant of hyde-m):

DEBUG 2018/01/17 20:26:25 Render page to "/2017/03/11/eu-ref-beyond-caring/index.html" with layouts ["post/single.html.html" "post/single.html" "_default/single.html.html" "_default/single.html" "theme/post/single.html.html" "theme/post/single.html" "theme/_default/single.html.html" "theme/_default/single.html"]
ERROR 2018/01/17 20:26:25 Error while rendering "page" in "archive/": template: archive/single.html:1:3: executing "archive/single.html" at <partial "head.html" ...>: error calling partial: Partial "head.html" not found

The archive pages have an overridden template that then refers to a partial in the theme; it used to work and now doesn’t. I can’t regress to 0.31 as all the versions in the snap are the same (virtually):

channels:                    
  stable:    0.32.4   (1133) 31MB -
  candidate: 0.32.4   (1133) 31MB -
  beta:      0.32.4   (1133) 31MB -
  edge:      0.33-DEV (1147) 31MB -

It also errors out with 0.33-DEV as well.

edit: I’ve downloaded 0.31.1 and it works fine.

Surely you can remove the snap and manually install a previous binary from the Hugo releases archive on Github, if this is critical and you need a functioning site for updates etc.

It would greatly help if you post a link to your Hugo project’s source.

It’s almost impossible to debug this without seeing the context of your templates.

Surely you can remove the snap and manually install a previous binary from the Hugo releases archive on Github, if this is critical and you need a functioning site for updates etc.

Indeed, I thought of that immediately after I posted; i just shadowed the snap with a download of the binary. Back up and running now.

It would greatly help if you post a link to your Hugo project’s source.
It’s almost impossible to debug this without seeing the context of your templates.

I can understand that; sadly the source is currently private. Something’s also changed “recently” (as in over the last 3 or 4 months) where my ‘about’ page has stopped being a single page and turned into a ‘list’ page. Obviously, there’s something wrong with how I’m doing/using the templates, and doing overrides. The archives one is possibly breaking due to the override template referring to a partial in the theme. Oh well, something to debug tomorrow.

I believe I’ve run into the same problem as described in this thread. I’d opened another discussion which has a downloadable zip which illustrates the problem. In my case, the issue was introduced between 0.31.1 and 0.32

So I’ve done some more debugging with 0.32 and 0.34. Essentially, the change in behaviour is that overridden templates can’t call partials defined in the theme. i.e. a template in:

layouts/_default/single.html

can’t (in my case) resolve a partial in:

themes/hyde-m/layouts/partials/sidebar.html

if it is referenced in the overridden single.html. If I copy sidebar.html to:

layouts/partials/sidebar.html

then it works and the page is rendered. The existing lookups seem to work fine on 0.31. Shall I raise a bug, or is this expected behaviour.

If you have a params named “theme” and language config, I suspect the real issue is this:

I think it probably was that. There was a param called ‘theme’. However, I think that you’ve fixed it in 0.35 (which the snap has updated to) and thus it’s working again - I’m reworking my theme around blocks anyway, and I’m going to call the param called ‘theme’, ‘scheme’ instead to prevent future breakage.

Thanks for your help!

1 Like