Feature request: Allow disabling the Subpages/ Table of Contents per page
Opened this issue · 2 comments
This feature request is proposing to add an option in the Advanced settings
of each page that allows to disable the auto-generated Table of Contents/ Subpages section of the page.
Background
A customer is building course material in their wiki and the Table of Contents/ Subpages leads to various visual glitches
-
The
Table of Contents
get automatically rendered even if the page contains only 1Header2
line. Their course structure involves 1 page per section/ learning hence all of their pages contain a superfluousTable of Contents
that list one item, pointing to the space right below it. -
The
Supages
overview is rendered above all content of a page and does not allow customization. In this scenario a page that summarizes and helps navigating multiple learning within a week start with an uncommented listing of subpages, followed by the customized guidance and navigation for this section of the course.
The ideal and hopefully easiest solution would be to implement a configuration option to disable the rendering of subpages and table of contents for each page. The option should/ could be choosen as False
to not change current functionality.
This request has become more urgent, so I started digging around
-
Subpages
If I understand it correctly, these are rendered on the server side in _view_category_index.php, hence the starting point would/ could be to add an option for this in Advanced settings and add an conditional to_view_category_index.php
-
Table of Contents
This looks trickier. From what I understand, the ToC is rendered via JS in humhub.wiki.Page.js#L64. I'm not sure though how the server could signal the JS to not render the ToC based on config option that works similarly to my proposal for subpages.
@luke-
Any hints/ recommendations/ pointers would be highly appreciated. I'm happy to try myself on a PR.
@dantefromhell From my side, a PR with additional options to hide the sub pages & the ToC would be fine.
Also a fix to hide the ToC if there is only one heading would be useful. Maybe we should create a bug issue here.