From 87d371f4687040452665bfe48a79687a0af80aa1 Mon Sep 17 00:00:00 2001 From: Max Bosche Date: Thu, 11 Apr 2019 10:45:43 +0200 Subject: [PATCH] solves #149 --- layouts/partials/nav.html | 53 +++++++++++++-------------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index c266ac4..6cb0532 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -41,46 +41,29 @@ {{ end }} {{ with .Site.GetPage "/home" }} - {{ range sort (.Resources.ByType "page") "Params.weight" }} + {{ $pages := .Resources.ByType "page" }} + + {{ with .Site.GetPage "/blog" }} + {{ $pages = $pages | append . }} + {{ end }} + + {{ with .Site.GetPage "/projects" }} + {{ $pages = $pages | append . }} + {{ end }} + + {{ range sort $pages "Params.weight" }} {{ if ne .Name "contact.md" }} + {{ if eq .File.Dir "projects/" }} + + {{ .Title }} + {{ else if eq .File.Dir "blog/" }} + + {{ .Title }} + {{ else }} {{ .Title }} {{ end }} {{ end }} {{ end }} - - {{ $pageIsInProjects := eq .Page.Section "projects"}} - {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "/projects" }} - {{ $totalProjects := (len .Pages) }} - {{ if $isHome }} - {{ .Title }} - {{ else }} - - {{ if $pageIsInProjects }} - {{ i18n "nav_backToSection" . }} - {{ else }} - {{ .Title }} - {{ end }} - - {{ end }} - {{ end }} - {{ end }} - - {{ $pageIsInBlog := eq .Page.Section "blog"}} - {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "/blog" }} - {{ if $isHome }} - {{ .Title }} - {{ else }} - - {{ if $pageIsInBlog }} - {{ i18n "nav_backToSection" . }} - {{ else }} - {{ .Title | singularize}} - {{ end }} - - {{ end }} - {{ end }} {{ end }} {{ with .Site.GetPage "/home" }}