Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Documentation: headers in a doc to the TOC?

Started by Muut Archive 10 years ago · 8 replies · 973 views
10 years ago

Is there a simple way to make headers of a page from the documentation (learn2) to be subtopics in the table of contents in the sidebar?

10 years ago

Just added these as sub-directories of the parent. They will automatically show up as submenu items. that way.

10 years ago

Not sure if I was clear on this. I mean headers like the #header line in a docs.md file.
By creating subfolders and in them separate docs.md files I would end up with separate pages and a menus that redirects to separate pages but the idea is to have one docs.md with headers (h1 or which is set for this purpose) that will show up with its headers as submenu items.

10 years ago

This plugin is really nice, thanks for pointing it out, but no, actually I was thinking of TOC as the menu items in the learn2 type documentation. But in essence what I'm asking is what this plugin you have shown to me does, only that I would need the headlines of a page not in the beginning of the page but as sub menu items in the menu sidebar in learn2 template.

10 years ago

It will take a little customization, but the output of the TOC is really just displayed with:

TWIG
{{ page.content|toc }}

So the trick will be to modify the code that loops over the pages to display the side menu, and see if it has a toc if so display it under the page title.

10 years ago

Ok. So currently it is not available the feature to have the headings as submenu items in the sidebar.
On http://learn.getgrav.org/ under the hosting menu how is the Shared Hosting and VPS hosting written out so that it will not display any page but will navigate to the submenu beneath it?
A side question: I noticed that on http://learn.getgrav.org/ the arrows, pg up/down works but does not work out of the box with the RTMF skeleton. How can it be activated?

10 years ago

Shared hosting is just a page under the Hosting page (as i explained in my first reply). See here: https://github.com/getgrav/grav-learn/tree/develop/pages/07.hosting

Those should work out of the box now. We just hadn't released an update to learn2 theme (which contained the fix), but we released that update yesterday. Simply do a bin/gpm update to get the latest version of learn2 theme.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1352 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4064 9 years ago
Archive · by Muut Archive, 9 years ago
1 2950 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago