None of the examples of site navigation in the
use recursion to go more than 3 levels deep. And I couldn’t find a
method on the interwebs that was exactly what I wanted, although
pretty close. Here, expanding on the method in
Chris Oliver’s old 2011 post,
this method passes the subtree as a parameter to the recursive call.
Given a data file called contents.yml…
…and an include file named tree.html (accepting the passed tree param in
include.tree on line 2 and recursion on line 4).
You then kick the whole thing off with a table of contents that includes the
tree.html include file, passing site.data.contents.tree as its tree parameter.