Setting up a wiki index?

Hello all,

I have a Grav site that is using theme learn2, It is a wiki site set up with hierarchical pages with each topic covering a subject and sub-pages covering parts of that topic. What I am wondering is if there is a way to use a twig to pull the title and link of all child pages (or descendent) and create a index link of all found entries. ie if the subject is linux and the child pages are php, mysql and apache. Then I can set the output of the linux page to be a listing of just links to these child pages pages (and if possible using descendents a nested listing.)

Any information is greatly appreciated.

First point I would make is that if you really want to create a wiki, you’re probably better off using software designed for that purpose. I’m a fan of the flat-file wiki Dokuwiki.

You appear to be looking for what Grav calls Page Collections.

Thank you for the suggestion. I actually moved away from dokuwiki and I will say it was quite easy to process which speaks well for this cms. The reason I moved is that this cms does allow for a more stream lined access and setup hierarchically and moving data around at whim is much easier too. and the learn2 theme is much cleaner. I did find that I can get a listing of pages with links with the following:


    items: '@self.children'

Text area :

{% for p in page.collection %}
[{{p.title}}]({{p.url}})<br />
{% endfor %}

Though this only give me one level down of data.

My goal overall is to learn how to use twigs in a way that lets me get children and then if possible children of children in a manner that lets me format the data with bullet points and sub level bullet points.

Does the content system allow for 2 variables that way a nested loop for be created?

I will continue to play around with the data and see what I can get.

You could use a plugin, too. DirectoryListing immediately comes to mind. Even if it doesn’t quite meet your needs, if you’re comfortable with PHP, you may be able to use it as a starting point.

Hi all,
I know this solution is far from being a Silver bullet, but here is what I did for the similar situation.

Toc plugin for individual pages + new Global Table of contents page for editors to append after creating an article.

  • But this only works for a closed group