diff options
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/header.html | 8 | ||||
-rw-r--r-- | layouts/partials/home/profile.html | 34 |
2 files changed, 22 insertions, 20 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7a3bfe6..55dd489 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -28,11 +28,9 @@ <div class="menu"> <div class="menu-inner"> {{- range .Site.Menus.main -}} - {{- $url := "" -}} + {{- $url := .URL | relLangURL -}} {{- with .Page -}} {{- $url = .RelPermalink -}} - {{- else -}} - {{- $url = .URL | relLangURL -}} {{- end -}} <a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}> {{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}} @@ -137,11 +135,9 @@ {{- end -}} {{- $currentPage := . -}} {{- range .Site.Menus.main -}} - {{- $url := "" -}} + {{- $url := .URL | relLangURL -}} {{- with .Page -}} {{- $url = .RelPermalink -}} - {{- else -}} - {{- $url = .URL | relLangURL -}} {{- end -}} <a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}> {{- .Pre | safeHTML }}{{ .Name }}{{ .Post | safeHTML -}} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 717420a..427ba8c 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -1,29 +1,35 @@ +{{- $profile := .Site.Params.home.profile -}} <div class="home-profile"> - {{- $avatar := .Site.Params.home.profile.avatarURL -}} - {{- with .Site.Params.home.profile.gravatarEmail -}} + {{- $avatar := $profile.avatarURL -}} + {{- with $profile.gravatarEmail -}} {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}} {{- end -}} {{- if $avatar -}} <div class="home-avatar"> - {{- $firstMenu := "" -}} - {{- if .Site.Menus.main -}} - {{- range first 1 $.Site.Menus.main -}} - {{- $firstMenu = . -}} + {{- $menus := $.Site.Menus.main | default slice -}} + {{- with index $menus 0 -}} + {{- $url := .URL | relLangURL -}} + {{- with .Page -}} + {{- $url = .RelPermalink -}} {{- end -}} - {{- end -}} - {{- with $firstMenu -}} - <a href="{{- .URL -}}" title="{{- .Name -}}"> + <a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}> {{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}} </a> {{- else -}} - {{- dict "src" $avatar "alt" " " | partial "plugin/image.html" -}} + {{- dict "src" $avatar | partial "plugin/image.html" -}} {{- end -}} </div> {{- end -}} - {{- with .Site.Params.home.profile.subtitle -}} + {{- with $profile.title -}} + <h1 class="home-title"> + {{- . -}} + </h1> + {{- end -}} + + {{- with $profile.subtitle -}} <h2 class="home-subtitle"> - {{- if $.Site.Params.home.profile.typeit -}} + {{- if $profile.typeit -}} {{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}} <div id="{{ $id }}" class="typeit"></div> {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} @@ -33,7 +39,7 @@ </h2> {{- end -}} - {{- if .Site.Params.home.profile.social -}} + {{- if $profile.social -}} <div class="social-links"> {{- $socialMap := resources.Get "data/social.yaml" | transform.Unmarshal -}} {{- $socialArr := slice -}} @@ -58,7 +64,7 @@ </div> {{- end -}} - {{- with .Site.Params.home.profile.disclaimer -}} + {{- with $profile.disclaimer -}} <h3 class="home-disclaimer"> {{- . | safeHTML -}} </h3> |