Q: TOC doesn't contain macro-generated headings?

Hi y’all,
I’ve just started using Zola, and I’m still trying to get my head around a few things (aside: coming from a very antique site generator/preprocessor, PPWizard, where everything works everywhere, I find it somewhat confusing that templates are only possible in html and not in Markdown, and that there’s a distinction between sections and pages). But back to my question :slight_smile:

One thing I’ve noticed: when I use a macro to generate a list of pages (e.g. blog posts), the headings don’t show up in the TOC.

here’s the macro:

{% macro page_summaries(section) %}
{% set section = get_section(path=section ~ "/_index.md") %}
    {% for page in section.pages %}
       {{ page.summary | safe }}
       <a href="{{ page.permalink | safe }}#continue-reading">
       More ...
       </a>
    {% endfor %}
{% endmacro page_summaries %}

The TOC part then just loops over the page.toc (if it exists, otherwise the section.toc) and puts out the permalinks/titles of found in the headers (I don’t include the code here).
In the Markdown file that uses this, there’s frontmatter and nothing but one heading. That heading shows up in the TOC. The rest of the headings show up just fine in the page rendered, but aren’t contained in the TOC.

Is this

  • working as designed?
  • a result of my stupidness?
  • something else?

Best, H.

The TOC is built from the markdown content, not from the rendered HTML content.

and that there’s a distinction between sections and pages

See Proposal: Deprecate sections