diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2018-09-12 14:36:16 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2018-09-12 14:36:16 +0200 |
commit | 80cca5b1befdbe1453bbf1bd92520403b0f5080f (patch) | |
tree | 2f7b18ebdb0d8bfbd4659abe42b85937ba784890 /layouts | |
parent | ca37d7488c726452739da68f9a096e0d8467d264 (diff) |
Simplify partials
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/docs/baseof.html | 13 | ||||
-rw-r--r-- | layouts/partials/docs/nav-bundle.html | 11 | ||||
-rw-r--r-- | layouts/partials/docs/nav-filetree.html (renamed from layouts/partials/docs/nav-tree.html) | 38 | ||||
-rw-r--r-- | layouts/partials/docs/nav.html | 5 |
4 files changed, 30 insertions, 37 deletions
diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 8509b14..f7e8477 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -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"> diff --git a/layouts/partials/docs/nav-bundle.html b/layouts/partials/docs/nav-bundle.html index 221325e..bdabefd 100644 --- a/layouts/partials/docs/nav-bundle.html +++ b/layouts/partials/docs/nav-bundle.html @@ -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 }}
\ No newline at end of file diff --git a/layouts/partials/docs/nav-tree.html b/layouts/partials/docs/nav-filetree.html index 6d0a2d5..c5ecfc8 100644 --- a/layouts/partials/docs/nav-tree.html +++ b/layouts/partials/docs/nav-filetree.html @@ -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 }} - -{{ if .Content }} -<a href="{{ .RelPermalink }}"> - {{- $title -}} -</a> -{{ else }} -<a> - {{- $title -}} -</a> -{{ end }} + {{ $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 }} {{ end }} diff --git a/layouts/partials/docs/nav.html b/layouts/partials/docs/nav.html deleted file mode 100644 index 96bc233..0000000 --- a/layouts/partials/docs/nav.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ if .Site.Params.BookMenuBundle }} - {{ partial "docs/nav-bundle" . }} -{{ else }} - {{ partial "docs/nav-tree" . }} -{{ end }}
\ No newline at end of file |