Add new setting to control how many headings are needed before showing in nav

This commit is contained in:
Che 2022-08-19 21:02:36 -04:00
parent 0e9a0a5986
commit 072fcfefc0
2 changed files with 7 additions and 2 deletions

View file

@ -19,3 +19,6 @@ easydocs_logo_always_clickable = false
# - Also requries the base URL to be set to the local folder where the site is stored eg. base_url = /home/user/mysite/public/
# - This is not portable and only works with a specific local folder
easydocs_uglyurls = false
# Controls how many headings are needed on a page before the headings show in the navigation on the left
easydocs_heading_threshold = 4

View file

@ -81,6 +81,7 @@
{% if current_path == page.path -%}
{# Count number of headers on page #}
{% set_global header_count = 0 -%}
{% for h2 in page.toc -%}
{% set_global header_count = header_count + 1 -%}
@ -92,7 +93,8 @@
{% endfor -%}
{% endfor -%}
{% if header_count > 4 -%}
{# Output headers if above threshold #}
{% if header_count > config.extra.easydocs_heading_threshold -%}
<ul id="toc">
{% for h2 in page.toc -%}
<li><a href="