How do show only filename matching index.json in data/?

I only want to show filenames of “index.json” which live throughout the data tree (i.e. in different directories). My non-working layouts/list.html looks like:

<h1>Show index.json only...</h1>
<ul>
{{ range .Site.Data.index }}
<li>{{ .name }}</li>
{{ end }}
</ul>

What do I do to fix it please?

I have a reduced test case here: https://s.natalian.org/2020-08-13/reduced-hugo.zip

My tact has changed from data driven to … content/ driven. This is where variables and most of Hugo makes sense. Can I generate posts from .Site.Data?

I.e. it’s easy to get the base filename with .File.BaseFileName from a _default/single.html template.

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