Created
March 28, 2017 22:44
-
-
Save BoyCook/c1f3d63e8a3b7e06282b65798929454b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#macro (findRoot $page) | |
#if ($page.parent) | |
#findRoot($page.parent) | |
#else | |
#set($root = $page) | |
#end | |
#end | |
#findRoot($page) | |
#set($current = $page) | |
#macro (selected) | |
#if ($page.title == $current.title) | |
class="selected-index" | |
#end | |
#end | |
#macro (createTreeNode $item) | |
<ul> | |
#foreach($child in $item.children) | |
<li> | |
($item.parent.title // $page.title) | |
#if ($item.parent.title == $page.title) | |
#set($down = false) | |
#end | |
<a href="$child.link">$child.title</a> | |
#if ($down != false) | |
#createTreeNode($child) | |
#end | |
</li> | |
#end | |
</ul> | |
#end | |
#macro (createNode $page) | |
<li #selected()> | |
<a href="$page.link">$page.title</a> | |
#if ($page.children) | |
<ul> | |
#foreach($child in $page.children) | |
<li> | |
<a href="$child.link">$child.title</a> | |
</li> | |
#end | |
</ul> | |
#end | |
</li> | |
#end | |
<section class="content-margin-top blog-index light-content"> | |
<a href="/"><h3>Docs</h3></a> | |
#createTreeNode($root) | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment