Consider this content structure
sec1/
_index.md // weight: 100
subsec1/
_index.md // weight: 50
a-content.md // weight: 100
b-content.md // weight: 10
subsubsec1/
_index.md // weight: 50
subsec2/
_index.md // weight: 15
subsubsec2/
_index.md // weigth: 25
c-content.md // weight: 10
sec2/
_index.md // weight: 5
subsec3/
_index.md // weight: 1
d-content.md // weight: 2
How can I create a template that will list the sections and pages according to their weight on the respective level they are at?
The output should be:
<ul>
<li>
<a>sec2</a> <!-- weight: 5 -->
<ul>
<li>
<a>subsec3</a> <!-- weigth: 1 -->
<ul>
<li>
<a>d-content</a> <!-- weight: 2 -->
</li>
</ul>
</li>
</ul>
</li>
<li>
<a>sec1</a> <!-- weight: 100 -->
<ul>
<li>
<a>subsec2</a> <!-- weight: 15 -->
<ul>
<li>
<a>subsubsec2</a> <!-- weight: 25 -->
<ul>
<li>
<a>c-content</a> <!-- weight: 10 -->
</li
</ul>
</li>
</ul>
</li>
<li>
<a>subsec1</a> <!-- weight: 50 -->
<ul>
<li>
<a>b-content</a> <!-- weight: 10 -->
</li>
<li>
<a>subsubsec1</a> <!-- weight: 50 -->
</li>
<li>
<a>a-content</a> <!-- weight: 100 -->
</i>
</ul>
</li>
</ul>
</li>
</ul>
As you can see, I want to list actual pages and section index pages by their weight.
However, I only found examples that list either Pages or Section Index pages, but no example of how to list both of them in the same (weighted) list…