diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html index 68b8da99..cf8d66cf 100644 --- a/layouts/partials/head/link.html +++ b/layouts/partials/head/link.html @@ -37,39 +37,6 @@ {{- 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/head/meta.html b/layouts/partials/head/meta.html index 9767fa79..14357f17 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -36,3 +36,19 @@ {{- with .Site.Params.app.tileColor -}} {{- end -}} + +{{- /* Mastodon Validation for the site */ -}} +{{- with .Site.Params.social.Mastodon -}} + {{- $id := "" -}} + {{- $prefix := "https://mastodon.social/" -}} + {{- if reflect.IsMap . -}} + {{- $id = .Id | default .id -}} + {{- $prefix = .Prefix | default .prefix | default $prefix -}} + {{- end -}} + {{- if $id | and $prefix -}} + {{- $link := printf "%s/%s" $prefix $id -}} + {{- $email := printf "%s@%s" (strings.TrimPrefix "@" $id) (urls.Parse $prefix).Host -}} + + + {{- end -}} +{{- end -}} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 7154c449..3be111dd 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -89,7 +89,17 @@ {{- $social = dict "Newtab" . | merge $social -}} {{- end -}} {{- with $value.icon -}} - {{- $social = dict "Icon" . | merge $social -}} + {{- $icon := dict -}} + {{- with .class -}} + {{- $icon = dict "Class" . | merge $icon -}} + {{- end -}} + {{- with .simpleicons -}} + {{- $icon = dict "Simpleicons" . | merge $icon -}} + {{- end -}} + {{- with .src -}} + {{- $icon = dict "Src" . | merge $icon -}} + {{- end -}} + {{- $social = dict "Icon" $icon | merge $social -}} {{- end -}} {{- else if ne $value true -}} {{- $social = dict "Id" $value | merge $social -}} diff --git a/layouts/partials/plugin/icon.html b/layouts/partials/plugin/icon.html index a083795c..cf8aaaca 100644 --- a/layouts/partials/plugin/icon.html +++ b/layouts/partials/plugin/icon.html @@ -8,7 +8,7 @@ {{- end -}} {{- if not $src -}} - {{- errorf "Icon src is missing" -}} + {{- errorf "Icon src is missing: %s" templates.Current.Filename -}} {{- end -}} {{- if (urls.Parse $src).Host | not -}}