X-Git-Url: https://git.danix.xyz/?a=blobdiff_plain;ds=sidebyside;f=layouts%2Fshortcodes%2Fgravatar.html;fp=layouts%2Fshortcodes%2Fgravatar.html;h=10b15e039368666e58bb22b3a60ef8a2626f5b8f;hb=e28a215c266b18d0a3eb7156345f8cdbab3a883b;hp=0000000000000000000000000000000000000000;hpb=213775dddc11bf89506c563df2ead19098d80e08;p=theme-danix.xyz.git
diff --git a/layouts/shortcodes/gravatar.html b/layouts/shortcodes/gravatar.html
new file mode 100644
index 0000000..10b15e0
--- /dev/null
+++ b/layouts/shortcodes/gravatar.html
@@ -0,0 +1,55 @@
+{{/*
+ * The gravatar shortcode:
+ * All arguments are optional, main ones are mail and size and have a fallback set in place.
+ * Args:
+ * mail: [string] The email address. Falls back to .Site.Params.author_email which should be set in your config file.
+ * size: [int] The size of the fetched image. Defaults to 200 if not set.
+ * class: [string] The class to give to the figure block.
+ * link: [string] The address to link the picture to.
+ * target: [string] Where to open the link. One of "_blank", "_self", "_parent", "_top".
+ * caption: [string] Caption text to show with the image. Supports Markdown.
+ *
+ * Usage:
+ * {{< gravatar mail="some@address.com" size=150 class="some class" link="https://example.com" target="_blank" rel="author" caption="Here's a picture of a dog." >}}
+ *
+ * Output:
+ *
+ *
+ */}}
+{{- if .Get "mail" -}}
+ {{- $mailaddr := .Get "mail" -}}
+ {{- .Scratch.Set "mailhash" $mailaddr -}}
+{{ else }}
+ {{- .Scratch.Set "mailhash" $.Site.Params.author_email -}}
+{{ end }}
+{{- $hash := .Scratch.Get "mailhash" | lower | md5 -}}
+
+