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!
# 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:
@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?
@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:
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!