From 80cca5b1befdbe1453bbf1bd92520403b0f5080f Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Wed, 12 Sep 2018 14:36:16 +0200 Subject: [PATCH] Simplify partials --- layouts/docs/baseof.html | 13 ++++++- layouts/partials/docs/nav-bundle.html | 11 ++---- .../docs/{nav-tree.html => nav-filetree.html} | 36 ++++++++----------- layouts/partials/docs/nav.html | 5 --- 4 files changed, 29 insertions(+), 36 deletions(-) rename layouts/partials/docs/{nav-tree.html => nav-filetree.html} (74%) delete mode 100644 layouts/partials/docs/nav.html 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 @@
- {{ partial "docs/nav" . }} +
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 @@ - +{{ 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 similarity index 74% rename from layouts/partials/docs/nav-tree.html rename to 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 }} - + {{ define "book-section" }} @@ -47,18 +39,18 @@ {{ 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 }} - - {{- $title -}} - -{{ else }} - - {{- $title -}} - -{{ end }} + {{ if .Content }} + + {{- $title -}} + + {{ else }} + + {{- $title -}} + + {{ 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