mirror of https://github.com/luizdepra/hugo-coder.git

Ka-Wai Lin
02.54.2020 e613e3ba00469dfb92a914ee0b0a4e489b1489cf
Adding gravatar support (#268)

* Gravatar support

Adding gravatar as alternative avatar

* Update CONTRIBUTORS.md
3 files modified
11 ■■■■ changed files
CONTRIBUTORS.md 1 ●●●● patch | view | raw | blame | history
exampleSite/config.toml 1 ●●●● patch | view | raw | blame | history
layouts/partials/home.html 9 ●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -58,3 +58,4 @@
- [FIGBERT](https://figbert.com/)
- [Yash Mehrotra](https://yashmehrotra.com)
- [Paolo Mainardi](https://paolomainardi.com)
- [Ka-Wai Lin](https://github.com/kwlin)
exampleSite/config.toml
@@ -21,6 +21,7 @@
    keywords = "blog,developer,personal"
    info = "Full Stack DevOps and Magician"
    avatarurl = "images/avatar.jpg"
    #gravatar = "john.doe@example.com"
    footercontent = "Enter a text here."
    dateformat = "January 2, 2006"
layouts/partials/home.html
@@ -1,7 +1,12 @@
<section class="container centered">
  <div class="about">
    {{ with .Site.Params.avatarurl }}
      <div class="avatar"><img src="{{ . | relURL }}" alt="avatar"></div>
    {{ if and (isset .Site.Params "avatarurl") (not (isset .Site.Params "gravatar")) }}
      {{ with .Site.Params.avatarurl }}
        <div class="avatar"><img src="{{ . | relURL }}" alt="avatar"></div>
      {{ end }}
    {{ end }}
    {{ with .Site.Params.gravatar }}
      <div class="avatar"><img src="https://www.gravatar.com/avatar/{{md5 .}}?s=240&d=mp" alt="gravatar"></div>
    {{ end }}
    <h1>{{ .Site.Params.author }}</h1>
    <h2>{{ .Site.Params.info }}</h2>