diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 2d126b6..7568437 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,18 +1,3 @@ -{{/* default favicon */}} -{{ $favicon := "/images/favicon.png" }} - -{{/* if favicon is provided in the config, then use that */}} -{{ if site.Params.logo.favicon }} - {{ $favicon = site.Params.logo.favicon }} -{{ end }} - -{{/* resize the favicon. don't resize svg because it is not supported */}} -{{ $favicon := resources.Get $favicon }} -{{ if and $favicon (ne $favicon.MediaType.SubType "svg") }} - {{ $favicon = $favicon.Resize "42x" }} -{{ end }} -{{ $favicon = $favicon.RelPermalink}} - @@ -28,5 +13,17 @@ - - + +{{/* add favicon only if the site author has provided the the favicon */}} +{{ if site.Params.logo.favicon }} + {{ $favicon := site.Params.logo.favicon }} + + {{/* resize the favicon. don't resize svg because it is not supported */}} + {{ $favicon = resources.Get $favicon }} + {{ if and $favicon (ne $favicon.MediaType.SubType "svg") }} + {{ $favicon = $favicon.Resize "42x" }} + {{ end }} + {{ $favicon = $favicon.RelPermalink}} + + +{{end}} diff --git a/layouts/partials/helpers/get-pages.html b/layouts/partials/helpers/get-pages.html new file mode 100644 index 0000000..8e06483 --- /dev/null +++ b/layouts/partials/helpers/get-pages.html @@ -0,0 +1,10 @@ +{{ $pages:= slice}} +{{ range . }} + {{ if .HasChildren }} + {{ $nestedPages:=partial "helpers/get-pages.html" .Children }} + {{ $pages = $pages | append $nestedPages }} + {{ else }} + {{ $pages = $pages | append .Page }} + {{ end }} +{{ end }} +{{ return $pages}} diff --git a/layouts/partials/navigators/navbar-2.html b/layouts/partials/navigators/navbar-2.html index 86b4626..c129f6e 100644 --- a/layouts/partials/navigators/navbar-2.html +++ b/layouts/partials/navigators/navbar-2.html @@ -1,28 +1,31 @@ -{{/* default logos */}} -{{ $mainLogo := "/images/main-logo.png" }} -{{ $invertedLogo := "/images/inverted-logo.png" }} +{{/* by default, don't use any logo */}} +{{ $mainLogo := "" }} +{{ $invertedLogo := "" }} -{{/* if custom logo has been provided in the config file, then use them */}} +{{/* if custom logo has been provided, use them */}} {{ if site.Params.logo.main }} {{ $mainLogo = site.Params.logo.main }} {{ end }} - {{ if site.Params.logo.inverted }} {{ $invertedLogo = site.Params.logo.inverted }} {{ end }} {{/* resize the logos. don't resize svg because it is not supported */}} -{{ $mainLogo := resources.Get $mainLogo}} -{{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }} - {{ $mainLogo = $mainLogo.Resize "42x" }} +{{ if $mainLogo }} + {{ $mainLogo = resources.Get $mainLogo}} + {{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }} + {{ $mainLogo = $mainLogo.Resize "42x" }} + {{ end }} + {{ $mainLogo = $mainLogo.RelPermalink}} {{ end }} -{{ $mainLogo = $mainLogo.RelPermalink}} -{{ $invertedLogo := resources.Get $invertedLogo}} -{{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg") }} - {{ $invertedLogo = $invertedLogo.Resize "42x" }} +{{ if $invertedLogo }} + {{ $invertedLogo = resources.Get $invertedLogo}} + {{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg")}} + {{ $invertedLogo = $invertedLogo.Resize "42x" }} + {{ end }} + {{ $invertedLogo = $invertedLogo.RelPermalink}} {{ end }} -{{ $invertedLogo = $invertedLogo.RelPermalink}} diff --git a/layouts/partials/navigators/navbar.html b/layouts/partials/navigators/navbar.html index df29cdc..ed6cff9 100644 --- a/layouts/partials/navigators/navbar.html +++ b/layouts/partials/navigators/navbar.html @@ -7,11 +7,11 @@ {{ $blogEnabled = true }} {{ end }} -{{/* default logos */}} -{{ $mainLogo := "/images/main-logo.png" }} -{{ $invertedLogo := "/images/inverted-logo.png" }} +{{/* by default, don't use any logo */}} +{{ $mainLogo := "" }} +{{ $invertedLogo := "" }} -{{/* if custom logo is used, them */}} +{{/* if custom logo has been provided, use them */}} {{ if site.Params.logo.main }} {{ $mainLogo = site.Params.logo.main }} {{ end }} @@ -20,17 +20,21 @@ {{ end }} {{/* resize the logos. don't resize svg because it is not supported */}} -{{ $mainLogo := resources.Get $mainLogo}} -{{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }} - {{ $mainLogo = $mainLogo.Resize "42x" }} +{{ if $mainLogo }} + {{ $mainLogo = resources.Get $mainLogo}} + {{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }} + {{ $mainLogo = $mainLogo.Resize "42x" }} + {{ end }} + {{ $mainLogo = $mainLogo.RelPermalink}} {{ end }} -{{ $mainLogo = $mainLogo.RelPermalink}} -{{ $invertedLogo := resources.Get $invertedLogo}} -{{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg")}} - {{ $invertedLogo = $invertedLogo.Resize "42x" }} +{{ if $invertedLogo }} + {{ $invertedLogo = resources.Get $invertedLogo}} + {{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg")}} + {{ $invertedLogo = $invertedLogo.Resize "42x" }} + {{ end }} + {{ $invertedLogo = $invertedLogo.RelPermalink}} {{ end }} -{{ $invertedLogo = $invertedLogo.RelPermalink}} {{ $customMenus := site.Params.customMenus }} {{ if (index site.Data site.Language.Lang).site.customMenus }} @@ -45,7 +49,9 @@ diff --git a/layouts/partials/navigators/next-prev-navigator.html b/layouts/partials/navigators/next-prev-navigator.html index f87c369..3738c67 100644 --- a/layouts/partials/navigators/next-prev-navigator.html +++ b/layouts/partials/navigators/next-prev-navigator.html @@ -1,33 +1,39 @@ +{{ $curPage := . }} +{{ $prevPage := "" }} +{{ $nextPage := "" }} + + +{{ $pages := partial "helpers/get-pages.html" site.Menus.sidebar }} + + +{{ $idx := 0 }} +{{ range $pages }} + {{ if eq .RelPermalink $curPage.RelPermalink }} + {{ $prevPage = index $pages (sub $idx 1) }} + {{ $nextPage = index $pages (add $idx 1) }} + {{ end }} + {{ $idx = add $idx 1 }} +{{ end }} +