-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide Table Of Contents when theres only 1 item #46
Comments
Got an example link of a page where this happens? |
Rather than fixing this in the app, I think we can fix this in the documentation sources, by simply removing that one heading. |
I'd say a single heading in a document is still important and helps structuring text visually and helps the human eye scanning a document. So I'd say single headlines should be kept! In the case of that maintenance page the headline below the title is of course useless. |
@Mark-H Can do this: {% if toc is not empty %}
<div class="l-main__toc">
<nav class="c-toc" aria-labelledby="toc-title">
<div class="c-toc__wrapper">
<span class="c-toc__title" id="toc-title">
{{ lang.in_this_document }}
</span>
{{ toc|raw }}
</div>
</nav>
</div>
{% endif %} Change to {% if toc|length > 1 %}
<div class="l-main__toc">
<nav class="c-toc" aria-labelledby="toc-title">
<div class="c-toc__wrapper">
<span class="c-toc__title" id="toc-title">
{{ lang.in_this_document }}
</span>
{{ toc|raw }}
</div>
</nav>
</div>
{% endif %} |
The In
From TocGenerator::getHtmlMenu:
So in Page->getTableOfContents I think we'll need to change getHtmlMenu to getMenu, check if it has at least 2 items, and if so render it. |
Well then check for JS and hide this section |
Summary
When showing the TOC, we should make sure there is more than 1 item. I'd propose to hide when there's only 1 heading
Why?
Not helpful for such small pages
The text was updated successfully, but these errors were encountered: