Link to home page when all projects are shown there

This commit is contained in:
Hanzei 2018-07-21 09:53:56 +02:00
parent 8fbb68c6be
commit 0de42476ae
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0

View file

@ -40,7 +40,7 @@
<a class="navbar-item" href="{{ "/" | absLangURL }}">{{ i18n "nav_main" . }}</a>
{{ end }}
{{ with .Site.GetPage "page" "home" }}
{{ with .Site.GetPage "page" "/home" }}
{{ range sort (.Resources.ByType "page") "Params.weight" }}
{{ if ne .Name "contact.md" }}
<a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | absLangURL }}{{ end }}">{{ .Title }}</a>
@ -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 }}
<a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
{{ else if le $totalProjects $numberOfProjectsToShow }}
<a class="navbar-item" href="/#{{ .Title | urlize }}">{{ .Title }}</a>
{{ else }}
<a class="navbar-item" href="{{ .Permalink }}">
{{ 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 }}
<a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
{{ else }}
@ -82,7 +86,7 @@
{{ end }}
{{ end }}
{{ with .Site.GetPage "page" "home" }}
{{ with .Site.GetPage "page" "/home" }}
{{ with .Resources.GetMatch "contact.md" }}
<a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | absLangURL }}{{ end }}">{{ .Title }}</a>
{{ end }}