From 87d371f4687040452665bfe48a79687a0af80aa1 Mon Sep 17 00:00:00 2001 From: Max Bosche Date: Thu, 11 Apr 2019 10:45:43 +0200 Subject: solves #149 --- layouts/partials/nav.html | 47 +++++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 32 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,44 +41,27 @@ {{ end }} {{ with .Site.GetPage "/home" }} - {{ range sort (.Resources.ByType "page") "Params.weight" }} - {{ if ne .Name "contact.md" }} - {{ .Title }} - {{ end }} - {{ end }} + {{ $pages := .Resources.ByType "page" }} + + {{ with .Site.GetPage "/blog" }} + {{ $pages = $pages | append . }} {{ 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 }} + {{ $pages = $pages | append . }} {{ end }} - {{ $pageIsInBlog := eq .Page.Section "blog"}} - {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "/blog" }} - {{ if $isHome }} - {{ .Title }} + {{ range sort $pages "Params.weight" }} + {{ if ne .Name "contact.md" }} + {{ if eq .File.Dir "projects/" }} + + {{ .Title }} + {{ else if eq .File.Dir "blog/" }} + + {{ .Title }} {{ else }} - - {{ if $pageIsInBlog }} - {{ i18n "nav_backToSection" . }} - {{ else }} - {{ .Title | singularize}} - {{ end }} - + {{ .Title }} + {{ end }} {{ end }} {{ end }} {{ end }} -- cgit v1.2.3 From 0dc9a5327a49a81532914ba385806b01e5c7f7da Mon Sep 17 00:00:00 2001 From: Max Bosche Date: Thu, 18 Apr 2019 09:10:42 +0200 Subject: fixed "Back to Blog" and "Back to Projects" --- layouts/partials/nav.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 6cb0532..96c841f 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -55,10 +55,36 @@ {{ if ne .Name "contact.md" }} {{ if eq .File.Dir "projects/" }} + {{ if $isHome }} {{ .Title }} + {{ else }} + {{ $pageIsInProjects := eq $.Page.Section "project"}} + {{ if not (and $pageIsInProjects (eq $.Page.Kind "section")) }} + + {{ if $pageIsInProjects }} + {{ i18n "nav_backToSection" . }} + {{ else }} + {{ .Title | singularize}} + {{ end }} + + {{ end }} + {{ end }} {{ else if eq .File.Dir "blog/" }} + {{ if $isHome }} {{ .Title }} + {{ else }} + {{ $pageIsInBlog := eq $.Page.Section "blog"}} + {{ if not (and $pageIsInBlog (eq $.Page.Kind "section")) }} + + {{ if $pageIsInBlog }} + {{ i18n "nav_backToSection" . }} + {{ else }} + {{ .Title | singularize}} + {{ end }} + + {{ end }} + {{ end }} {{ else }} {{ .Title }} {{ end }} -- cgit v1.2.3