zregvart commented on a change in pull request #210: Feature Avatar on Blog 
Posts
URL: https://github.com/apache/camel-website/pull/210#discussion_r398524808
 
 

 ##########
 File path: layouts/blog/post.html
 ##########
 @@ -9,8 +9,22 @@ <h1><a href="{{.Page.Permalink}}">{{ .Title }}</a></h1>
     <div class="post">
         <aside>
             <div class="summary">{{ .Params.preview }}</div>
-            <time itemprop="published" datetime="{{ dateFormat "2006-01-02" 
.PublishDate }}" title="{{ dateFormat "Monday, January 2, 2006" .PublishDate 
}}">{{ dateFormat "January 2, 2006" .PublishDate }}</time>
-            <p>by <span rel="author">{{ .Params.author }}</span></p>
+            <div class="info">
+                {{ $avatar := newScratch }}
+                {{ $avatar.Set "url" "_/img/avatar.svg" }}
+
+                {{ if .Params.github_user }}
+                    {{ $userData := getJSON "https://api.github.com/users/"; 
.Params.github_user }}
+                    {{ $avatar.Set "url" $userData.avatar_url }}
+                {{ end }}
+                    <div class="post-avatar">
+                            <img src="{{ $avatar.Get "url" | relURL }}" 
class="avatar">
+                    </div>
 
 Review comment:
   I would do this without the scratch and without as many divs, like (haven't 
tested):
   
   ```suggestion
                   {{ if .Params.github_user }}
                       {{ $userData := getJSON "https://api.github.com/users/"; 
.Params.github_user }}
                       <img src="{{ $userData.avatar_url }}" class="avatar" 
alt="{{ .Params.author }}">
                   {{ else }}
                       <img src="{{ "/_/img/avatar.svg" | relURL }} " 
class="avatar" alt="{{ .Params.author }}">
                   {{ end }}
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to