Skip to content

Commit 0144763

Browse files
committed
Fix gravatarEmail between 0.17 & 0.18
hugo 0.17 expects ".Site.Author.gravatarEmail" whereas hugo 0.18 expects ".Site.Author.gravataremail"
1 parent 0a55ace commit 0144763

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

layouts/partials/head.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
{{ else }}
1010
{{ .Scratch.Set "sidebarBehavior" .Site.Params.sidebarBehavior }}
1111
{{ end }}
12+
<!-- Fix hugo 0.17 expects ".Site.Author.gravatarEmail" whereas hugo 0.18 expects ".Site.Author.gravataremail" -->
13+
{{ if .Site.Author.gravatarEmail }}
14+
{{ .Scratch.Set "gravatarEmail" .Site.Author.gravatarEmail }}
15+
{{ end }}
1216
{{ if .Site.Author.gravataremail }}
13-
{{ .Scratch.Set "authorPicture" (printf "//www.gravatar.com/avatar/%s" (urlize (md5 .Site.Author.gravataremail))) }}
17+
{{ .Scratch.Set "gravatarEmail" .Site.Author.gravataremail }}
18+
{{ end }}
19+
{{ if .Scratch.Get "gravatarEmail" }}
20+
{{ .Scratch.Set "authorPicture" (printf "//www.gravatar.com/avatar/%s" (urlize (md5 (.Scratch.Get "gravatarEmail")))) }}
1421
{{ else if .Site.Author.picture }}
1522
{{ .Scratch.Set "authorPicture" (absURL .Site.Author.picture) }}
1623
{{ end }}
@@ -54,8 +61,8 @@
5461
{{ end }}
5562
{{ end }}
5663

57-
{{ if .Site.Author.gravataremail }}
58-
<meta property="og:image" content="//www.gravatar.com/avatar/{{ (md5 .Site.Author.gravataremail) | urlize }}?s=640">
64+
{{ if .Scratch.Get "gravatarEmail" }}
65+
<meta property="og:image" content="//www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640">
5966
{{ else if .Site.Author.picture }}
6067
<meta property="og:image" content="{{ .Site.Author.picture | absURL }}">
6168
{{ end }}

0 commit comments

Comments
 (0)