Errors after upgrade to 0.13

I’ve just installed, 0.13 alongside 0.12 [so luckily I can roll back!] and am getting the following two errors when running ‘hugo server’:

ERROR: 2015/02/27 Error while rendering homepage: template: theme/index.html:20:12: executing "theme/index.html" at <where .Data.Pages "l...>: error calling where: layout is an unexported field of struct type *hugolib.Page
ERROR: 2015/02/27 Walker:  lstat /Users/madra/Sites/ no such file or directory

 I'm presuming the 2nd one has something to do with the new: 

* *Support for data files in YAML, JSON, or TOML located in the data directory (#885)*

feature but, as regards the first error, it seems to refer to a file that doesn't exist so I don't know where to start in 'repairing' a theme that was previously working fine in 0.12. Is there any info on how to update themes from 0.12 to 0.13  anywhere?

Is your source available?

Create that data directory and it should move past the error. It can be empty.

For the other one, do you have “where .Data.Pages.layout” in your theme’s top-level index.html template?

Thanks for the help, guys.

Creating an empty ‘data’ directory has cleared the second error. However, as regards the first:

  • I have no ‘top level’ index.html file in my theme. The only index.html file in the theme is at:

<themename> > layouts > index.html

…and it doesn’t contain the text “where .Data.Pages.layout”

The structure of my theme is as follows:

…and if you want to look at the theme source, you can grab it from here:


Your theme’s layouts/index.html has {{ range where .Data.Pages "layout" "post" }}. The where needs updating. I’m looking for the note on that.

Changing it to `{{ range where .Data.Pages “Section” “post” }}’ gets rid of the error. I don’t understand what you’re doing with “layouts”, so I’m not sure if this moves you towards what you’re trying to do.

layout is a variable on Page that can be set in front matter (list, single, index ?), but the exported func was removed at some point.

Ah. Now we’re getting somehwere!

My site has one static ‘About’ page which I wanted to prevent from being included in the list of blog posts. So my frontmatter has: layout=post for every page except the About page which instead has: layout = "staticpage"

The {{ range where .Data.Pages "layout" "post" }} line in my theme index is just there to filter out anything that isn’t a post [ie. the About page], when rendering the blog list.

I arrived at this solution after previously posting about what I wanted to do in this thead where bjornerik recommended I used {{ range where .Data.Pages "Type" "post" }} to achieve what I wanted. The reason I used {{ range where .Data.Pages "layout" "post" }} instead was because when I defined “Type” [or “type”] in template and front-matter, the site rendered completely blank in spite of Hugo not throwing up any errors –whereas using “layout” instead worked.

Anyway, the TL;DR: is I’ve now changed all my frontmatter layout="<whatever>" to type="<whatever>" and the template code to {{ range where .Data.Pages "Type" "post" }} and, whilst this still results in a completely blank site in Hugo 0,12, it does work properly under Hugo 0,13.

So I guess I’ll just file under “Mysteries of The Deep” and finally get on with kicking the tyres of 0,13. Boy –will my site welcome the arrival of pagination!

Thanks again for the help, folks. Whilst I didn’t solve the mystery at least I’m up and running again.

I’m sorry about the growing pains and glad that you found the solution.