mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 14:59:45 +00:00
Link to home page when all projects are shown there
This commit is contained in:
parent
8fbb68c6be
commit
0de42476ae
1 changed files with 8 additions and 4 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue