fix(menu): hide divider when no menus (#307)

This commit is contained in:
Dave A-W
2020-05-04 15:24:40 +08:00
committed by GitHub
parent 4190c79491
commit 417851b1cd
3 changed files with 20 additions and 5 deletions

View File

@@ -17,6 +17,9 @@
@include border-radius(100%);
@include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05));
@include transition(all 0.4s ease);
}
a img {
cursor: pointer;
&:hover {

View File

@@ -38,7 +38,9 @@
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a>
{{- end -}}
<span class="menu-item delimiter"></span>
{{- if .Site.Menus.main -}}
<span class="menu-item delimiter"></span>
{{- end -}}
{{- if .Site.IsMultiLingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
{{- .Language.LanguageName -}}

View File

@@ -3,11 +3,21 @@
{{- with .Site.Params.home.profile.gravatarEmail -}}
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
{{- end -}}
{{- with $avatar -}}
{{- if $avatar -}}
<div class="home-avatar">
<a href="/posts" title="{{ T `home` }}">
{{- dict "src" . "alt" (T "home") | partial "plugin/image.html" -}}
</a>
{{- $firstMenu := "" -}}
{{- if .Site.Menus.main -}}
{{- range first 1 $.Site.Menus.main -}}
{{- $firstMenu = . -}}
{{- end -}}
{{- end -}}
{{- with $firstMenu -}}
<a href="{{- .URL -}}" title="{{- .Name -}}">
{{- dict "src" $avatar "alt" .Name | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "src" $avatar "alt" " " | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}