Error during travisCI build: ".Render only available for regular pages"

When running our build using Travis, we run into this error:

$ hugo --cleanDestinationDir
Started building sites …
ERROR 2017/03/28 21:04:52 .Render only available for regular pages, not for of kind “home”. You probably meant .Site.RegularPages and not.Site.Pages.
Built site for language en:

The build works fine locally. It was also working fine on Friday (4 days) ago. Nothing had changed with our site, but the error started occurring. I am wondering if it is related to this commit, which happened 2 days ago:

https://github.com/spf13/hugo/commit/930a3df1b79d21f005a63918b89cc01ae5a4cd9e

Yes, and the error message is pretty clear. You should fix your layouts/index.html template.

Thank you for the prompt reply. I have two follow up questions:

  1. Why is it throwing an error on Travis but not locally? I’ve updated my local Hugo to: Hugo Static Site Generator v0.19 darwin/amd64 BuildDate: 2017-02-27T03:21:29-07:00
  2. We only had one spot where we called .Site.Pages. We fixed that and still got the error. Here is our layouts/index.html template, which calls .Render “content-single” (should be unrelated?):

{{ partial "header" . }} {{ $.Scratch.Set "shareNav" true }} {{ partial "navbar" . }} {{ partial "share-menu" . }} <!-- Main --> <div id="main"> <!-- Post --> {{ $.Scratch.Set "h1" true }} {{ .Render "content-single" }} </div> {{ partial "sidebar" . }} {{ partial "footer" . }}

I will reduce the ERROR to a WARNING, which is more in line with the old behavior.

See

https://github.com/spf13/hugo/commit/87b3cd4655088c5e4bb519ea310386959850000d

And

https://github.com/spf13/hugo/issues/3245

Now you will have the old behaviour, and eventually we will upgrade the Render method to work with all.

Hi bep, thank you for working on this right away, I appreciate that.

Just to be clear so I understand, is our layouts/index.html template valid?

{{ partial "header" . }}
{{ $.Scratch.Set "shareNav" true }}
{{ partial "navbar" . }}
{{ partial "share-menu" . }}
<!-- Main -->
<div id="main">
<!-- Post -->
{{ $.Scratch.Set "h1" true }}
{{ .Render "content-single" }}
</div>
{{ partial "sidebar" . }}
{{ partial "footer" . }}

Should we be allowed to call .Render from within a static home page (not a list of posts)?

Note that the .Render method was created before we merged Node and Page and … everything got to be a page. And I kind of forgot about it; the old regular pages works a little bit special in the template/layout department, which .Render hooks into. I will fix that, but not right now.

So, if that is your entire layouts/index.html, it doesn’t make sense as a home page template.

The

{{ .Render "content-single" }}

Is even saying “single”, which is a little misldeading for a Home page. But that will with Hugo 0.20 only render blank, with a WARNING in the log. A partial may be better in this case, not sure.