@@ -60,7 +60,7 @@ def read_section(path):
6060 return out
6161
6262# Nav section generation
63- def generate_nav (sections ):
63+ def generate_nav (page , sections ):
6464 out = ""
6565 for sect in sections :
6666 sect_id = sect ["id" ]
@@ -70,8 +70,18 @@ def generate_nav(sections):
7070 out += f"<a href='#{ sect_id } '>{ name } </a>"
7171 if len (children ) > 0 :
7272 out += "<div class='navindent'>"
73- out += generate_nav (children )
73+ out += generate_nav ("__INDENT__" + page , children )
7474 out += "</div>"
75+
76+ if (not page .startswith ("__INDENT__" )):
77+ out += "<div id='nav-links'>\n "
78+ if (page != "index" ):
79+ out += '<a href="/" class="fa-solid fa-house"></a>\n '
80+ out += """
81+ <a href="https://github.com/p2sr/rules" target="_blank" class="fa-brands fa-github"></a>
82+ <a href="https://discord.com/invite/hRwE4Zr" target="_blank" class="fa-brands fa-discord"></a>
83+ </div>
84+ """
7585
7686 return out
7787
@@ -145,12 +155,7 @@ def _repl(m):
145155
146156 out = (template
147157 .replace ("{{CONTENT}}" , content )
148- .replace ("{{NAV_MENU}}" , generate_nav (md .toc_tokens ) + """
149- <div id='nav-links'>
150- <a href="https://github.com/p2sr/rules" target="_blank" class="fa-brands fa-github"></a>
151- <a href="https://discord.com/invite/hRwE4Zr" target="_blank" class="fa-brands fa-discord"></a>
152- </div>
153- """ )
158+ .replace ("{{NAV_MENU}}" , generate_nav (page , md .toc_tokens ))
154159 .replace ("{{COMMAND_LIST}}" , commands )
155160 )
156161
0 commit comments