Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanzei <hanzei@mailbox.org>2018-07-21 10:53:56 +0300
committerHanzei <hanzei@mailbox.org>2018-07-21 10:53:56 +0300
commit0de42476aedd6962e1907329983667ed68683ea7 (patch)
tree3e1673664e65da7af54ae1eed94fef4e8cfb05ad /layouts
parent8fbb68c6bedea34ec2038ee34824cba81a95b99f (diff)
Link to home page when all projects are shown there
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/nav.html12
1 files 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 @@
<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 }}