zregvart commented on a change in pull request #272:  Pull contributor data 
from JSON APIs
URL: https://github.com/apache/camel-website/pull/272#discussion_r398635213
 
 

 ##########
 File path: layouts/shortcodes/contributors.html
 ##########
 @@ -0,0 +1,32 @@
+{{ $urlPre := "https://api.github.com/repos"; }}
+{{ $username := "Apache" }}
+{{ $repo := "camel-website"}}
+{{ $token := ""}}
+<!-- Enter token here -->
+{{ $scope := "all"}}
+{{ if eq $token "" }}
+<p>Unable to get contributors details[set token]</p>
+{{else}}
+{{ $collaborators := getJSON $urlPre "/" $username "/" $repo 
"/collaborators?access_token=" $token  }}
+
+<table class="tableblock frame-all grid-all stretch">
+    <thead>
+        <tr>
+            <th>Name</th>
+            <th>Organisation</th>
+        </tr>
+    </thead>
+    <tbody>
+
+        {{range $collaborators}}
+        {{$user := getJSON .url}}
+        {{if $user.name  }}
+        <tr>
+            <td> {{$user.name}} </td>
+            <td> {{$user.company}} </td>
+        </tr>
+        {{end}}
+        {{end}}
+    </tbody>
+</table>
+{{end}}
 
 Review comment:
   We write Hugo template directives with spaces after `{{` and before `}}`, 
makes it much easier to read.

----------------------------------------------------------------
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