Is there a simple way to get the number of items (elements) in a range, without iterating the range and implementing a counter?
If not, is there specific support for getting the number of sections in the site (Site.Params.sections count)?
Is there a simple way to get the number of items (elements) in a range, without iterating the range and implementing a counter?
If not, is there specific support for getting the number of sections in the site (Site.Params.sections count)?
Use the len func.
Thanks @bep. I previously missed this function because it’s not included in the side-menu TOC of the Functions Quick Reference page.
What I wanted was to conditionally execute some code only when there is more than one doc section, which I was now able to do using the condition {{ if gt (len .Site.Params.sections) 1 }}. --> I’m marking this issue as “[Solved]”. Thanks.