Simplify partials
This commit is contained in:
parent
ca37d7488c
commit
80cca5b1be
4 changed files with 29 additions and 36 deletions
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}
|
||||
{{- .Content -}}
|
||||
{{ end }}
|
|
@ -9,21 +9,13 @@
|
|||
{{ $singleSection := index $bookSections 0 }}
|
||||
{{ .Scratch.Set "BookSections" $singleSection.Sections }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
<nav role="navigation">
|
||||
{{ partial "docs/nav-brand" . }}
|
||||
{{ partial "docs/inject/nav-before" . }}
|
||||
|
||||
<ul>
|
||||
<ul>
|
||||
{{ range .Scratch.Get "BookSections" }}
|
||||
{{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ partial "docs/inject/nav-after" . }}
|
||||
</nav>
|
||||
</ul>
|
||||
|
||||
<!-- Single section of menu (recursive) -->
|
||||
{{ define "book-section" }}
|
||||
|
@ -47,18 +39,18 @@
|
|||
<!-- Menu Heading -->
|
||||
{{ define "book-heading" }}
|
||||
|
||||
{{ $sections := split (trim .Dir "/") "/" }}
|
||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||
{{ $title := default .Title $title }}
|
||||
{{ $sections := split (trim .Dir "/") "/" }}
|
||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||
{{ $title := default .Title $title }}
|
||||
|
||||
{{ if .Content }}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- $title -}}
|
||||
</a>
|
||||
{{ else }}
|
||||
<a>
|
||||
{{- $title -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if .Content }}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- $title -}}
|
||||
</a>
|
||||
{{ else }}
|
||||
<a>
|
||||
{{- $title -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
|
@ -1,5 +0,0 @@
|
|||
{{ if .Site.Params.BookMenuBundle }}
|
||||
{{ partial "docs/nav-bundle" . }}
|
||||
{{ else }}
|
||||
{{ partial "docs/nav-tree" . }}
|
||||
{{ end }}
|
Loading…
Reference in a new issue