diff options
author | Giuseppe Pignataro <rogepix@gmail.com> | 2019-03-15 13:06:37 +0300 |
---|---|---|
committer | Giuseppe Pignataro <rogepix@gmail.com> | 2019-03-15 13:06:37 +0300 |
commit | 7fa7590d2fcee805a0c924492a8765d80d08905c (patch) | |
tree | c6e547ef630246396944fe7d8cd6123fae386c29 | |
parent | d27cd5358a4518bafe812caa66a9d0ee35922592 (diff) |
Added gravatar support
-rw-r--r-- | exampleSite/config.toml | 7 | ||||
-rw-r--r-- | layouts/partials/home_post.html | 8 | ||||
-rw-r--r-- | layouts/partials/home_profile.html | 8 |
3 files changed, 9 insertions, 14 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 37c3712..78a80ab 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -42,7 +42,6 @@ disqusShortname = "yourdiscussshortname" [params] since = 2012 author = "Fastbyte01" # Author's name - avatar = "/images/me/avatar.jpeg" # Author's avatar subtitle = "A Hugo theme" # Subtitle cdn_url = "" # Base CDN URL home_mode = "" # post or other @@ -51,10 +50,8 @@ disqusShortname = "yourdiscussshortname" socialShare = true - - - - +[params.gravatar] + email = "" description = "" # site description keywords = "" # site keywords diff --git a/layouts/partials/home_post.html b/layouts/partials/home_post.html index 60cc8ae..594b298 100644 --- a/layouts/partials/home_post.html +++ b/layouts/partials/home_post.html @@ -1,11 +1,10 @@ <div class="post-warp"> <div class="intro"> - {{ $cdn_url := .Scratch.Get "cdn_url" }} - {{ with .Site.Params.avatar}} - {{ $avatar := .}} + {{ $cdn_url := .Scratch.Get "cdn_url" }} + <div class="avatar"> - <a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a> + <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatar.email }}?s=240&d=mp" alt="gravatar"> </div> {{ end }} {{ with .Site.Params.subtitle}} @@ -63,3 +62,4 @@ {{ partial "paginator.html" . }} </div> + diff --git a/layouts/partials/home_profile.html b/layouts/partials/home_profile.html index f4307d3..fc92926 100644 --- a/layouts/partials/home_profile.html +++ b/layouts/partials/home_profile.html @@ -1,11 +1,9 @@ <div class="intro"> {{ $cdn_url := .Scratch.Get "cdn_url" }} - {{ with .Site.Params.avatar}} - {{ $avatar := .}} + <div class="avatar"> - <a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a> + <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatar.email }}?s=240&d=mp" alt="gravatar"> </div> - {{ end }} {{ with .Site.Params.subtitle}} <h2 class="description"> {{ . }} @@ -14,4 +12,4 @@ <div class="social-links"> {{ partial "social.html" . }} </div> -</div>
\ No newline at end of file +</div> |