Template code can't iterate the filetree as before

Hi, the template and directory structure below used to produce a sidebar with a recursive filetree menu, but now it doesn’t anymore. To be precise, I can’t iterate through what’s under “content/docs”, when before I could. Yet the site is rendered identically as before, pages appear under /en/ all right.
It’s supposed to render as something like:

(start template)
<menu>
(iterate filetree under docs)
<li>{{ if branch bundle }}<details><summary>{{ branch bundle title }}</summary> -> (start_template)
</details>{{else}}(link page)</li>(end iterate)
(end template)
content
 ├──􀀂  docs 
 │  ├──􀀂  Biology 
 │  │  ├──􀇱  _index.md 
 │  │  └──􀇱  4 unlisted 
 │  ├──􀀂  History 
 │  │  ├──􀇱  _index.md 
 │  │  └──􀇱  4 unlisted 
 │  └──􀀂  Love 
 │     ├──􀇱  _index.md 
 │     └──􀇱  2 unlisted 
 └──􀇱  intro.md

code:

{{ template "menu-filetree" (dict "Section" (site.GetPage "docs") "CurrentPage" $) }}
{{ define "menu-filetree" }}
 <menu role="navigation" class=filetree>
{{ range $context1 := (where .Section.Pages "Params.bookHidden" false) }}
	<li>
	{{ with (dict "Page" . "CurrentPage" $.CurrentPage) }}
		{{ $current := eq .CurrentPage .Page }}
		{{ $ancestor := .Page.IsAncestor .CurrentPage }}
		{{ if .Page.IsSection }}
		<details {{ if $ancestor }}class=ancestor open{{ end }}>
	    <summary role=button>
	    {{- partial "docs/title-menu" .Page -}}
	    </summary>
	    {{ template "menu-filetree" (dict "Section" $context1 "CurrentPage" $.CurrentPage) }}
	</details>
		 {{ else }}
	    <a href="{{ .Page.RelPermalink }}" {{if $current}}aria-current=page {{end}}>{{- partial "docs/title-menu" .Page -}}</a>
		  {{ end }}
	{{end}}
	</li>
{{ end }}
</menu>
{{ end }}

Does it work with v0.122.0? Please test to be sure.

Does it work with v0.123.6?

With neither version.

OK, thanks. Just making sure this wasn’t a regression with v0.123.x.

Your menu code works fine for me, provided that I have “bookHidden = false” set on relevant pages, including section pages. Perhaps you fouled up a cascade somewhere.

The only mention of “cascade” in the whole project (repo)is what you helped writing:

[[cascade]]
bookHidden = false
bookSearchExclude = false
[cascade._build]
render = false
list = false
[cascade._target]
path = '/intro'

[[cascade]]
[cascade.build]
list = 'never'
render = 'never'
[cascade._target]
kind = 'section'

I don’t know what to tell you. Your code worked fine for me. I suggest you put in some debugging statements on your side to check for page counts, etc.

Within the template, at its start, the value of {{.}} is map[CurrentPage:Page(/docs/love/spirituality) Section:Page(/docs)], the value of {{.Section}} is Page(/docs) and the value of {{.Section.Pages}} is Pages(0).
So it seems to descend into /docs, but sees nothing. That’s why I said I could iterate through the folders under docs/. I don’t know what more debugging to do.

What does it mean ? What more information do you need ?

In Need help with mounts you wanted to disable rendering of all section pages under docs.

Now you want to access section pages that you’ve disabled.

Which one do you want?

If you want something in between look at the other build options.

It should very much be the issue, yes.
list = never, that is… But even when I remove the corresponding [[cascade]] in config the error doesn’t budge ?

I have no idea what you are you doing, no repository to work with, and am unable to replicate any of the problems you mentioned.

You have a repo. Change list = 'never'' by list = 'always' in the hugo.toml, and nothing else. What happens then ?

edit: sorry, I mixed up with the “unrecognized character” thread, where someone gave an advice that might or not bear on this topic here). Repo corrected.

Where’s the repo? Did you send me an invitation to join? If so please re-send.

I’ll look at a GitHub or GitLab repository, if I have the time and inclination, but not Google Drive, Dropbox, zip files, etc. Maybe someone can help.

Yeah, which is the equivalent of me not asking anything, because I can’t use git, I couldn’t make it work (not to upload things). Some people are not developers.
This topic is closed, I’ll manage to rewrite the template. It’s never good to keep legacy code that “just works” without understanding it anyway.

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