Newbie question: how do I make my section visible on the root page?

As per title, and apologies for this being likely too obvious.

I managed to get a hold of the basics and make pages render correctly, have paginators, use a theme, and a few other things.

However, having my blog articles inside content/b, I can’t see anything related to them on the root page (during zola serve to be precise).

Additionally, I also made my sidebar work. So, is there a way to have a sidebar-like functionality for the blog articles? Or all section articles?

I have _index.md in both content and content/b directories.

Bottom line: why is my section practically invisible from the root page?

You can iterate on section.subsections to get the path of subsections and then use get_section (https://www.getzola.org/documentation/templates/overview/#get-section) to get them.

1 Like

I have something like this in my index.html template:

{% for section in section.subsections | reverse %}
									
    {% set sub = get_section(path=section) %}
									
   <p class="title grow">
        <a href="{{sub.permalink | safe}}" class="button is-dark shadow is-normal">
            {{ sub.components | first | capitalize}}
        </a>
    </p>
									
{% endfor %}

So basically loop over subsections from the root, which will be the content directories in the content folder and then in my case I reverse the order. Then use the subsection to get the section permalink which I can link to.

Hope this gives you some ideas.

1 Like

Posted to wrong place…

So you guys mean that this functionality doesn’t come out of the box? Slightly disappointing but on the other hand Zola seems very customisable for which I am grateful.

Thank you. I’ll see what I can put together and will report back.

That’s because the template engine has to serialize everything to JSON so doing that by default everytime would kill performance, even if you don’t need it. If someone manages to skip that step in Tera, I’d be more than happy to make that the default :wink:

1 Like