Skip to content

Commit

Permalink
Fix gravatarEmail between 0.17 & 0.18
Browse files Browse the repository at this point in the history
hugo 0.17 expects ".Site.Author.gravatarEmail" whereas hugo 0.18 expects ".Site.Author.gravataremail"
  • Loading branch information
kakawait committed Feb 14, 2017
1 parent 4fa97ca commit f958ce2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@
{{ else }}
{{ .Scratch.Set "sidebarBehavior" .Site.Params.sidebarBehavior }}
{{ end }}
<!-- Fix hugo 0.17 expects ".Site.Author.gravatarEmail" whereas hugo 0.18 expects ".Site.Author.gravataremail" -->
{{ if .Site.Author.gravatarEmail }}
{{ .Scratch.Set "gravatarEmail" .Site.Author.gravatarEmail }}
{{ end }}
{{ if .Site.Author.gravataremail }}
{{ .Scratch.Set "authorPicture" (printf "//www.gravatar.com/avatar/%s" (urlize (md5 .Site.Author.gravataremail))) }}
{{ .Scratch.Set "gravatarEmail" .Site.Author.gravataremail }}
{{ end }}
{{ if .Scratch.Get "gravatarEmail" }}
{{ .Scratch.Set "authorPicture" (printf "//www.gravatar.com/avatar/%s" (urlize (md5 (.Scratch.Get "gravatarEmail")))) }}
{{ else if .Site.Author.picture }}
{{ .Scratch.Set "authorPicture" (absURL .Site.Author.picture) }}
{{ end }}
Expand Down Expand Up @@ -54,8 +61,8 @@
{{ end }}
{{ end }}

{{ if .Site.Author.gravataremail }}
<meta property="og:image" content="//www.gravatar.com/avatar/{{ (md5 .Site.Author.gravataremail) | urlize }}?s=640">
{{ if .Scratch.Get "gravatarEmail" }}
<meta property="og:image" content="//www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640">
{{ else if .Site.Author.picture }}
<meta property="og:image" content="{{ .Site.Author.picture | absURL }}">
{{ end }}
Expand Down

0 comments on commit f958ce2

Please sign in to comment.