✂ Content (Work, projects, notes, contributions, etc.) is being added.
We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Counting pages in sections from other sections in Zola
2022-10-11 ・ Zola
For the design of this website (as of 2022-10-11), I wanted to include the number of pages in a section—e.g., in the menu. I found a post on the Zola forum1 where I learnt about the get_section
and a section's pages
variable. Then in the Tera documentation2, I found the length
function.
Between the 2 of these, I'm able to display the pages count.
Example
{% set notes = get_section(path="notes/_index.md") -%}
{{ notes.pages | length }}