diff --git a/assets/css/_core/_header.scss b/assets/css/_core/_header.scss index a231c86f6..7a43ebe3f 100644 --- a/assets/css/_core/_header.scss +++ b/assets/css/_core/_header.scss @@ -279,6 +279,8 @@ header { border-radius: $global-border-radius; border: 1px solid $menu-border-color; background-color: $header-background-color; + max-height: 60vh; + overflow-y: auto; @include transition(box-shadow 0.3s ease); @include box-shadow(0 0 1.5rem 0 rgba(0, 0, 0, 0.1)); diff --git a/hugo.toml b/hugo.toml index 89a688972..f8decf497 100644 --- a/hugo.toml +++ b/hugo.toml @@ -901,6 +901,8 @@ enableEmoji = true # Depends on open custom blocks https://fixit.lruihao.cn/references/blocks/ [params.customPartials] head = [] + menuDesktop = [] + menuMobile = [] profile = [] aside = [] comment = [] diff --git a/layouts/partials/custom.html b/layouts/partials/custom.html index 8af789867..dc0b21097 100644 --- a/layouts/partials/custom.html +++ b/layouts/partials/custom.html @@ -5,6 +5,20 @@ {{- end -}} {{- end -}} +{{- define "custom-menu:desktop" -}} + {{- $ctx := . -}} + {{- range .Site.Params.customPartials.menuDesktop -}} + {{- partial . $ctx -}} + {{- end -}} +{{- end -}} + +{{- define "custom-menu:mobile" -}} + {{- $ctx := . -}} + {{- range .Site.Params.customPartials.menuMobile -}} + {{- partial . $ctx -}} + {{- end -}} +{{- end -}} + {{- define "custom-profile" -}} {{- $ctx := . -}} {{- range .Site.Params.customPartials.profile -}} diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html index cf8d66cfc..68b8da993 100644 --- a/layouts/partials/head/link.html +++ b/layouts/partials/head/link.html @@ -37,6 +37,39 @@ {{- end -}} +{{- /* Mastodon Validation for the site */ -}} +{{- with .Site.Params.social.Mastodon -}} + {{- $mastodonConfig := . -}} + {{- $id := "" -}} + {{- $prefix := "https://mastodon.social/" -}} + + {{- /* Check if Mastodon is a string */ -}} + {{- if printf "%T" $mastodonConfig | eq "string" -}} + {{- $id = strings.TrimPrefix "@" $mastodonConfig -}} + + {{- /* Check if Mastodon is a map/object */ -}} + {{- else if printf "%T" $mastodonConfig | eq "map[string]interface {}" -}} + {{- $id = .Id | default .id | default "" | strings.TrimPrefix "@" -}} + {{- $prefix = .Prefix | default .prefix | default $prefix -}} + + {{- /* If it's neither a string nor a map, do nothing */ -}} + {{- else -}} + {{- errorf "Invalid Mastodon configuration: %#v" $mastodonConfig -}} + {{- end -}} + + {{- /* Remove trailing slash from prefix */ -}} + {{- $prefix = strings.TrimSuffix "/" $prefix -}} + + {{- /* Construct profile URL */ -}} + {{- $profileUrl := printf "%s/@%s" $prefix $id -}} + + {{- /* Only proceed if we have a valid ID */ -}} + {{- if $id -}} + + + {{- end -}} +{{- end -}} + {{- /* style.min.css */ -}} {{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}} {{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7abafef86..67587a8fd 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -144,6 +144,9 @@ {{- end -}} + + {{- /* Custom menu items in the desktop header */ -}} + {{- block "custom-menu:desktop" . }}{{ end -}} @@ -305,6 +308,9 @@ {{- end -}} + + {{- /* Custom menu items in the mobile header */ -}} + {{- block "custom-menu:mobile" . }}{{ end -}} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 01548bfab..912c5f225 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-f66dc32e" -}} +{{- .Scratch.Set "version" "v0.3.16-fda3fa66" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}}