2 * The gravatar shortcode:
3 * All arguments are optional, main ones are mail and size and have a fallback set in place.
5 * mail: [string] The email address. Falls back to .Site.Params.author_email which should be set in your config file.
6 * size: [int] The size of the fetched image. Defaults to
200 if not set.
7 * class: [string] The class to give to the figure block.
8 * link: [string] The address to link the picture to.
9 * target: [string] Where to open the link. One of
"_blank",
"_self",
"_parent",
"_top".
10 * caption: [string] Caption text to show with the image. Supports Markdown.
13 * {{< 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." >}}
16 *
<figure class=
"some class">
17 *
<a href=
"https://example.com" target=
"_blank" rel=
"author">
18 *
<img src=
"https://www.gravatar.com/avatar/emailhash?s=150" alt=
"Here's a picture of a dog." />
22 * Here's a picture of a dog.
29 {{- if .Get
"mail" -}}
30 {{- $mailaddr := .Get
"mail" -}}
31 {{- .Scratch.Set
"mailhash" $mailaddr -}}
33 {{- .Scratch.Set
"mailhash" $.Site.Params.author_email -}}
35 {{- $hash := .Scratch.Get
"mailhash" | lower | md5 -}}
37 <figure{{ with .Get
"class" }}
class=
"{{ . }}"{{ end }}
>
38 {{- if .Get
"link" -}}
39 <a href=
"{{ .Get "link
" }}"{{ with .Get
"target" }}
target=
"{{ . }}"{{ end }}{{ with .Get
"rel" }}
rel=
"{{ . }}"{{ end }}
>
41 <img src=
"https://www.gravatar.com/avatar/{{- $hash -}}?s={{- with .Get "size
" }}{{.}}{{ else }}200{{ end }}"
42 {{- if or (.Get
"alt") (.Get
"caption") }}
43 alt=
"{{ with .Get "alt
" }}{{ . }}{{ else }}{{ .Get "caption
" | markdownify| plainify }}{{ end }}"
46 {{- if .Get
"link" -}}
49 {{- if .Get
"caption" -}}
52 {{- .Get
"caption" | markdownify -}}