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 <16541325+hanzei@users.noreply.github.com>2019-04-24 17:51:35 +0300
committerGitHub <noreply@github.com>2019-04-24 17:51:35 +0300
commit770fd5c0a6341a0f6b2a73539ea5751abea94df8 (patch)
tree2c6458cdd1aaa834924f00b56eef60c22f94dc16
parent76123d68537ba0576f7575f1e3ff9b1a33f900af (diff)
parent0dc9a5327a49a81532914ba385806b01e5c7f7da (diff)
Fix sorted menu (#150)
-rw-r--r--layouts/partials/nav.html71
1 files changed, 40 insertions, 31 deletions
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,44 +41,53 @@
{{ end }}
{{ with .Site.GetPage "/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 | urlize) | relLangURL }}{{ end }}">{{ .Title }}</a>
- {{ end }}
- {{ end }}
+ {{ $pages := .Resources.ByType "page" }}
+
+ {{ with .Site.GetPage "/blog" }}
+ {{ $pages = $pages | append . }}
{{ end }}
- {{ $pageIsInProjects := eq .Page.Section "projects"}}
- {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "/projects" }}
- {{ $totalProjects := (len .Pages) }}
- {{ if $isHome }}
- <a class="navbar-item" href="{{ printf "#%s" (.Title | urlize) }}">{{ .Title }}</a>
- {{ else }}
- <a class="navbar-item" href="{{ .Permalink }}">
- {{ if $pageIsInProjects }}
- {{ i18n "nav_backToSection" . }}
- {{ else }}
- {{ .Title }}
- {{ end }}
- </a>
- {{ end }}
- {{ end }}
+ {{ $pages = $pages | append . }}
{{ end }}
- {{ $pageIsInBlog := eq .Page.Section "blog"}}
- {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }}
- {{ with .Site.GetPage "/blog" }}
- {{ if $isHome }}
- <a class="navbar-item" href="{{ printf "#%s" (.Title | urlize) }}">{{ .Title }}</a>
- {{ else }}
- <a class="navbar-item" href="{{ .Permalink }}">
- {{ if $pageIsInBlog }}
- {{ i18n "nav_backToSection" . }}
+ {{ range sort $pages "Params.weight" }}
+ {{ if ne .Name "contact.md" }}
+ {{ if eq .File.Dir "projects/" }}
+ <!-- Now for some cool projects -->
+ {{ if $isHome }}
+ <a class="navbar-item" href="{{ printf "/#%s" ( .Title | urlize) | relLangURL }}">{{ .Title }}</a>
{{ else }}
- {{ .Title | singularize}}
+ {{ $pageIsInProjects := eq $.Page.Section "project"}}
+ {{ if not (and $pageIsInProjects (eq $.Page.Kind "section")) }}
+ <a class="navbar-item" href="{{ .Permalink }}">
+ {{ if $pageIsInProjects }}
+ {{ i18n "nav_backToSection" . }}
+ {{ else }}
+ {{ .Title | singularize}}
+ {{ end }}
+ </a>
{{ end }}
- </a>
+ {{ end }}
+ {{ else if eq .File.Dir "blog/" }}
+ <!-- Let`s show some blog posts -->
+ {{ if $isHome }}
+ <a class="navbar-item" href="{{ printf "/#%s" ( .Title | urlize) | relLangURL }}">{{ .Title }}</a>
+ {{ else }}
+ {{ $pageIsInBlog := eq $.Page.Section "blog"}}
+ {{ if not (and $pageIsInBlog (eq $.Page.Kind "section")) }}
+ <a class="navbar-item" href="{{ .Permalink }}">
+ {{ if $pageIsInBlog }}
+ {{ i18n "nav_backToSection" . }}
+ {{ else }}
+ {{ .Title | singularize}}
+ {{ end }}
+ </a>
+ {{ end }}
+ {{ end }}
+ {{ else }}
+ <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" (.File.TranslationBaseName | urlize) | relLangURL }}{{ end }}">{{ .Title }}</a>
+ {{ end }}
{{ end }}
{{ end }}
{{ end }}