Branch bundle page not rendering

Hi,
I am trying out this theme and have been researching for a while on how to get a branch bundle rendered in this theme, but haven’t gotten anywhere.

Following the instructions in Hugo’s quick start doc, I created a new site with the aforementioned theme. Then, I followed the directions in the starting fresh section of the template, and copied all files from the exampleSite directory into the main folder.

I’m now trying to add a root-level section (mysection in the GitHub repo linked below) to the default content that was populated from exampleSite. To do that, I created the mysection folder, an _index.md file (to doubly-ensure that Hugo interprets this bundle as a branch bundle), and a couple of leaf bundles in that folder. However, Hugo simply doesn’t render the mysection page.

After searching through the discussion forum, and studying the template lookup order, I thought the issue would be resolved by including a list.html in the layouts/_default folder (since the Hugo docs specify that a branch bundle uses the list layout, and the theme I’m using had a blank layout for list.html), but I’m still seeing only a blank page at localhost:1313/mysection.

Here is the information needed for anyone interested in reproducing the issue:

$ hugo env
hugo v0.92.0+extended linux/amd64 BuildDate=unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.17.6"
$ git version
git version 2.35.1 

I feel that I’m missing something elementary, but unable to figure out what it is after hours and hours of researching. Can someone please shed some light on why the branch bundle page isn’t rendering? Thanks!

See config.toml

# This is a "one page"-website, so we do not need these kinds of pages...
disableKinds = ["section", "taxonomy", "term", "RSS", "robotsTXT"]

Section pages are disabled. If you remove section from this array, Hugo will try to render your section page using layouts/_default/list.html, which throws an error:

Error: Error building site: “/home/jmooring/temp/hugo-test-theme-1/layouts/_default/list.html:14:1”: parse failed: template: _default/list.html:14: unexpected EOF

Once you fix that (your range is missing an end), you can access your section page at:
http://localhost:1313/mysection/test/

A link to it will not show up on the home page, because

This is a “one page”-website, so we do not need these kinds of pages

Please see the theme documentation:
https://github.com/janraasch/hugo-scroll

And contact the theme author for additional questions related to this theme:
https://github.com/janraasch/hugo-scroll/issues

@jmooring: Thank you so much for your prompt response, I really appreciate it!

I don’t intend to show links to these kinds of pages on the home page, but only on a separate mysection page. I only wanted to link the mysection page into the homepage.

Your edits solved the issue of mysection not rendering for me. I’m, however, not clear why the mysection page is displaying the statement from the else block of the following code snippet:

{{ if eq .Layout "list" }}    
   <div>some stuff to be shown if [nameOfYourTemplate] is used to render the current page</div>    
{{ else }}      
   <div>some stuff to be shown if [nameOfYourTemplate] is NOT used to render the current page</div>    
{{ end }}

If my understanding is correct, this page should use the list layout, and so should display the first statement, not the second one. What am I missing?

Place this in the template to see its value and type:

{{ printf "value = %[1]v, type = %[1]T" .Layout }}

@jmooring: I adapted that code snippet from this discussion when I was trying to debug the issue myself. I’m not sure if something changed in Hugo in the interim to break that code in the latest version.

On including your code snippet in my layouts/_default/list.html, I see:

value = , type = string 

What am I doing wrong?

.Page.Layout returns the value of layout from front matter:

content/post/test.md

+++
title = 'Test'
date = 2021-01-01T00:00:00-00:00
draft = false
layout = "foo"
+++

layouts/_default/single.html

{{ printf "value = %[1]v, type = %[1]T" .Layout }}  --> value = foo, type = string
1 Like

@jmooring: Understood, that works!

For my own understanding, I’m wondering if there is any way to see which layout a given page is using if it’s not explicitly declared in the front-matter.

Thanks again for your prompt response, love this community!

No, but I wish there were, if for no other reason than debugging.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.