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

github.com/Lednerb/bilberry-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Brendel <mail@lednerb.eu>2020-08-15 18:07:27 +0300
committerSascha Brendel <mail@lednerb.eu>2020-08-15 18:07:27 +0300
commita4e436d1c353eab59d77653dc9521bb6cdd963b1 (patch)
treeb7bccc977bae7a1a48c1b1625c311920c4e9f784
parent6e7d6f9b51c62c9ef635cbe04c4a1286f7198637 (diff)
Integrated backwards compatible feature for using libravatar. Closes #245
-rw-r--r--exampleSite/config.toml8
-rw-r--r--layouts/partials/header.html84
2 files changed, 51 insertions, 41 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 7711c5f..51ca433 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -58,13 +58,13 @@ disqusShortname = ""
# your subtitle if you want to use any
subtitle = "Hello World! This is the most epic subtitle ever."
- # if you want to use gravatar for the header image
- gravatarEMail = "code@lednerb.de"
+ # if you want to use libravatar or gravatar for the header image
+ avatarEmail = "code@lednerb.de"
- # set an path to the image file you want to use | overwrites gravatar
+ # set an path to the image file you want to use | overwrites avatar by email
customImage = ""
- # define the icon you want to use for the overlay for the customImage or gravatar.
+ # define the icon you want to use for the overlay for the customImage or avatar.
overlayIcon = "fa-home"
# always display the top navigation (with pages and search) on non-mobile screens
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index d2d0fb7..6977884 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,47 +1,57 @@
{{ if and .Site.Params.permanentTopNav .Site.Params.stickyNav }}
-<header class="sticky">
+ <header class="sticky">
{{ else }}
-<header>
+ <header>
{{ end }}
- <div class="container">
- <div class="logo">
- <a href="{{ .Site.BaseURL | relLangURL }}" class="logo">
- {{ if and (isset .Site.Params "customimage") (ne .Site.Params.customImage "") }}
- <img src="{{ .Site.Params.customImage | relURL }}" alt="">
- {{ else }}
- <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatarEMail }}?d=mm&size=200" alt="">
+ <div class="container">
+ <div class="logo">
+ <a href="{{ .Site.BaseURL | relLangURL }}" class="logo">
+ {{ if and (isset .Site.Params "customimage") (ne .Site.Params.customImage "") }}
+ <img src="{{ .Site.Params.customImage | relURL }}" alt="">
+ {{ else }}
+ {{ $avatarEmail := "" }}
+ {{ if not (eq .Site.Params.avatarEmail nil) }}
+ {{ $avatarEmail = .Site.Params.avatarEmail }}
+ {{ else }}
+ {{ $avatarEmail = .Site.Params.gravatarEMail }}
+ {{ end }}
+ <img src="https://seccdn.libravatar.org/avatar/{{ md5 $avatarEmail }}?d=mm&size=200" alt="">
+ {{ end }}
+
+ <span class="overlay"><i class="fa {{ .Site.Params.overlayIcon | default "fa-home" }}"></i></span>
+ </a>
+ </div>
+ <div class="titles">
+ <h3 class="title">
+ <a href="{{ .Site.BaseURL | relLangURL }}">
+ {{ .Site.Title | default "My cool new blog" }}
+ </a>
+ </h3>
+
+ {{ with .Site.Params.Subtitle }}
+ <span class="subtitle">{{ . }}</span>
{{ end }}
+ </div>
- <span class="overlay"><i class="fa {{ .Site.Params.overlayIcon | default "fa-home" }}"></i></span>
- </a>
- </div>
- <div class="titles">
- <h3 class="title"><a
- href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title | default "My cool new blog" }}</a></h3>
- {{ with .Site.Params.Subtitle }}
- <span class="subtitle">{{ . }}</span>
+ {{ if and (gt .Site.Languages 1) (.Site.Params.showHeaderLanguageChooser | default true) }}
+ {{- $language := .Language -}}
+ <div class="languages">
+ {{ range $.Site.Home.AllTranslations }}
+ {{ if eq $language .Language }}
+ <a href="{{ .Permalink }}" class="active">{{ .Language }}</a>
+ {{ else }}
+ <a href="{{ .Permalink }}">{{ .Language }}</a>
+ {{ end }}
+ {{ end }}
+ </div>
{{ end }}
- </div>
- {{ if and (gt .Site.Languages 1) (.Site.Params.showHeaderLanguageChooser | default true) }}
- {{- $.Scratch.Set "language" .Language -}}
- <div class="languages">
- {{ range $.Site.Home.AllTranslations }}
- {{ if eq ($.Scratch.Get "language") .Language }}
- <a href="{{ .Permalink }}" class="active">{{ .Language }}</a>
+ {{ if .Site.Params.permanentTopNav }}
+ <div class="toggler permanentTopNav">
{{ else }}
- <a href="{{ .Permalink }}">{{ .Language }}</a>
+ <div class="toggler">
{{ end }}
- {{ end }}
- </div>
- {{ end }}
-
- {{ if .Site.Params.permanentTopNav }}
- <div class="toggler permanentTopNav">
- {{ else }}
- <div class="toggler">
- {{ end }}
- <i class="fa fa-bars" aria-hidden="true"></i>
+ <i class="fa fa-bars" aria-hidden="true"></i>
+ </div>
</div>
- </div>
-</header>
+ </header>