Simplify partials

This commit is contained in:
Alex Shpak 2018-09-12 14:36:16 +02:00
parent ca37d7488c
commit 80cca5b1be
4 changed files with 29 additions and 36 deletions

View file

@ -10,7 +10,18 @@
<div class="pure-g">
<div class="pure-u book-nav">
{{ partial "docs/nav" . }}
<nav role="navigation">
{{ partial "docs/nav-brand" . }}
{{ partial "docs/inject/nav-before" . }}
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/nav-bundle" . }}
{{ else }}
{{ partial "docs/nav-filetree" . }}
{{ end }}
{{ partial "docs/inject/nav-after" . }}
</nav>
</div>
<div class="pure-u book-content">
<div class="pure-g">

View file

@ -1,8 +1,3 @@
<nav role="navigation">
{{ partial "docs/nav-brand" . }}
{{ partial "docs/inject/nav-before" . }}
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}
{{- .Content -}}
{{ end }}
{{ partial "docs/inject/nav-after" . }}
</nav>

View file

@ -9,22 +9,14 @@
{{ $singleSection := index $bookSections 0 }}
{{ .Scratch.Set "BookSections" $singleSection.Sections }}
{{ end }}
{{ end }}
<nav role="navigation">
{{ partial "docs/nav-brand" . }}
{{ partial "docs/inject/nav-before" . }}
<ul>
{{ range .Scratch.Get "BookSections" }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
{{ end }}
</ul>
{{ partial "docs/inject/nav-after" . }}
</nav>
<!-- Single section of menu (recursive) -->
{{ define "book-section" }}
<li {{ if .Section.Params.booktopsection }}class="book-nav-section"{{ end }}>

View file

@ -1,5 +0,0 @@
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/nav-bundle" . }}
{{ else }}
{{ partial "docs/nav-tree" . }}
{{ end }}