diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index c266ac4..96c841f 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -41,46 +41,55 @@ {{ 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/" }} + + {{ 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 }} {{ 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" }}