From c0115f6d94e47d93674a7e346d1fb2a856e50bfa Mon Sep 17 00:00:00 2001
From: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com>
Date: Mon, 2 Dec 2024 19:22:22 -0500
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89Feat:=20add=20automatic=20generatio?=
=?UTF-8?q?n=20of=20mastodon=20verification=20links?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com>
---
layouts/partials/head/link.html | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html
index cf8d66cf..68b8da99 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 -}}