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 }}