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:
authorMax Bosche <max@enten.space>2019-04-11 11:45:43 +0300
committerMax Bosche <max@enten.space>2019-04-11 11:45:43 +0300
commit87d371f4687040452665bfe48a79687a0af80aa1 (patch)
tree56083a335d31fd52435928bf149c66335b8a8c9a /layouts
parent76123d68537ba0576f7575f1e3ff9b1a33f900af (diff)
solves #149
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/nav.html47
1 files changed, 15 insertions, 32 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index c266ac4..6cb0532 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -41,44 +41,27 @@
{{ 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>
+ {{ range sort $pages "Params.weight" }}
+ {{ if ne .Name "contact.md" }}
+ {{ if eq .File.Dir "projects/" }}
+ <!-- Now for some cool projects -->
+ <a class="navbar-item" href="{{ printf "/#%s" ( .Title | urlize) | relLangURL }}">{{ .Title }}</a>
+ {{ else if eq .File.Dir "blog/" }}
+ <!-- Let`s show some blog posts -->
+ <a class="navbar-item" href="{{ printf "/#%s" ( .Title | urlize) | relLangURL }}">{{ .Title }}</a>
{{ else }}
- <a class="navbar-item" href="{{ .Permalink }}">
- {{ if $pageIsInBlog }}
- {{ i18n "nav_backToSection" . }}
- {{ else }}
- {{ .Title | singularize}}
- {{ end }}
- </a>
+ <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" (.File.TranslationBaseName | urlize) | relLangURL }}{{ end }}">{{ .Title }}</a>
+ {{ end }}
{{ end }}
{{ end }}
{{ end }}