feat: add multi level section menu

This commit is contained in:
Henk Verlinde 2022-01-18 20:48:17 +01:00
parent 40a8705ab6
commit 4f9365181d
8 changed files with 168 additions and 1 deletions

View File

@ -10,6 +10,12 @@
identifier = "help"
url = "/docs/help/"
[[docs]]
name = "Lorem"
weight = 70
identifier = "lorem"
url = "/docs/lorem/"
[[main]]
name = "Docs"
url = "/docs/prologue/introduction/"

View File

@ -0,0 +1,10 @@
---
title: "Lorem"
description: ""
lead: ""
date: 2022-01-18T19:58:14+01:00
lastmod: 2022-01-18T19:58:14+01:00
draft: false
images: []
toc: true
---

View File

@ -0,0 +1,15 @@
---
title: "Ipsum"
description: ""
lead: ""
date: 2022-01-18T20:00:32+01:00
lastmod: 2022-01-18T20:00:32+01:00
draft: false
images: []
menu:
docs:
parent: "lorem"
identifier: "ipsum"
weight: 999
toc: true
---

View File

@ -0,0 +1,15 @@
---
title: "Amet"
description: ""
lead: ""
date: 2022-01-18T20:07:56+01:00
lastmod: 2022-01-18T20:07:56+01:00
draft: false
images: []
menu:
docs:
parent: "ipsum"
identifier: "amet"
weight: 999
toc: true
---

View File

@ -0,0 +1,14 @@
---
title: "Consectetur"
description: ""
lead: ""
date: 2022-01-18T20:17:32+01:00
lastmod: 2022-01-18T20:17:32+01:00
draft: false
images: []
menu:
docs:
parent: "amet"
weight: 730
toc: true
---

View File

@ -0,0 +1,14 @@
---
title: "Dolor"
description: ""
lead: ""
date: 2022-01-18T20:01:45+01:00
lastmod: 2022-01-18T20:01:45+01:00
draft: false
images: []
menu:
docs:
parent: "ipsum"
weight: 700
toc: true
---

View File

@ -0,0 +1,14 @@
---
title: "Sit"
description: ""
lead: ""
date: 2022-01-18T20:05:19+01:00
lastmod: 2022-01-18T20:05:19+01:00
draft: false
images: []
menu:
docs:
parent: "ipsum"
weight: 710
toc: true
---

View File

@ -1,3 +1,81 @@
<aside>
<ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . }}
{{ range .Site.Menus.docs }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</aside>
<!--
{{ if .Site.Params.options.collapsibleSidebar -}}
<ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}}
@ -36,4 +114,5 @@
</ul>
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
-->