From 0de42476aedd6962e1907329983667ed68683ea7 Mon Sep 17 00:00:00 2001 From: Hanzei Date: Sat, 21 Jul 2018 09:53:56 +0200 Subject: [PATCH] Link to home page when all projects are shown there --- layouts/partials/nav.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index b38c7fc..a40fd79 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -40,7 +40,7 @@ {{ i18n "nav_main" . }} {{ end }} - {{ with .Site.GetPage "page" "home" }} + {{ with .Site.GetPage "page" "/home" }} {{ range sort (.Resources.ByType "page") "Params.weight" }} {{ if ne .Name "contact.md" }} {{ .Title }} @@ -50,9 +50,13 @@ {{ $pageIsInProjects := eq .Page.Section "projects"}} {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "section" "projects" }} + {{ with .Site.GetPage "section" "/projects" }} + {{ $totalProjects := (len .Pages) }} + {{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }} {{ if $isHome }} {{ .Title }} + {{ else if le $totalProjects $numberOfProjectsToShow }} + {{ .Title }} {{ else }} {{ if $pageIsInProjects }} @@ -67,7 +71,7 @@ {{ $pageIsInBlog := eq .Page.Section "blog"}} {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "section" "blog" }} + {{ with .Site.GetPage "section" "/blog" }} {{ if $isHome }} {{ .Title }} {{ else }} @@ -82,7 +86,7 @@ {{ end }} {{ end }} - {{ with .Site.GetPage "page" "home" }} + {{ with .Site.GetPage "page" "/home" }} {{ with .Resources.GetMatch "contact.md" }} {{ .Title }} {{ end }}