Proper content structure or how to stop render of excess pages?

I have complex pages, with content:


And layout like:

I’ve found that Hugo generate html page for index, a, a2 and every section of this page. This is ok, I red articles and got this, but I still can’t get the way how this should be. My list layout works with

{{ $pages := .Pages }}
{{ $pages := sort $pages ".Params.weight" }}
{{ range $pages }}
{{ end }}

Is there more elegant solution for this with fixing my issue?

I don’t quite understand your issue, but please have a look at filtering and limiting lists in the Docs.

The main issue is related with excess of rendered .html files. After hugo render in my about folder I have index.html, a folder, a2 folder and etc. I need only about/index.html and that’s why I started to try re-organize content/layouts

So, I would like to render only list page and ignore render of single pages for this layout

The only way to achieve what you want would be to reorganize your content files into a leaf Page Bundle.

└── content
    └── about

With the above structure, etc will not be permalinkable and will only be accessible as Page Resources of /about/.

Then in a single page template you can render these pages like so:

{{- with .Resources.ByType "page" -}}
{{- range . -}} 
{{- .Content -}}
{{- end -}}
{{- end -}}

Further reading:

1 Like

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