Browse Source

Allow showing multiple authors below the post

Kevin van Zonneveld 6 years ago
parent
commit
4b7fadd0c3

+ 1 - 1
website/src/_posts/2019-03-26-30daystoliftoff-day1.md

@@ -1,6 +1,6 @@
 ---
 title: "Day 1"
-author: kvz
+author: [kvz, aj]
 image: "https://uppy.io/images/blog/30daystoliftoff/inspace.jpg"
 series: 30 Days to Liftoff
 seriesSuffix: 'of 30'

+ 22 - 9
website/themes/uppy/layout/post.ejs

@@ -34,16 +34,29 @@
                 }
             })
     %>
-        <p><%- '↬ In this series: [ ' + seriesList.join(' | ') + ' ] ' + (page.seriesSuffix || '') %></p>
+    <p><%- '↬ In this series: [ ' + seriesList.join(' | ') + ' ] ' + (page.seriesSuffix || '') %></p>
+    <% } %>
+    <%- page.content %>
+    <% 
+        var authors = page.author 
+        if (authors === (authors + '')) { 
+            authors = [ page.author ]
+        }
+
+        console.log(authors)
+        
+
+        for (var i in authors) {
+            var author = authors[i]
+    %>
+        <div class="PostAuthor">
+            <a href="https://transloadit.com/about/#<%- site.data.authors[author].id %>">
+                <img class="PostAuthor-img" src="<%- gravatar(site.data.authors[author].email, 200) %>">
+                <h4 class="PostAuthor-name"><%- site.data.authors[author].name %></h4>
+                <h5 class="PostAuthor-tagline"><%- site.data.authors[author].tagline %></h5>
+            </a>
+        </div>
     <% } %>
-  <%- page.content %>
-  <div class="PostAuthor">
-    <a href="https://transloadit.com/about/#<%- site.data.authors[page.author].id %>">
-      <img class="PostAuthor-img" src="<%- gravatar(site.data.authors[page.author].email, 200) %>">
-      <h4 class="PostAuthor-name"><%- site.data.authors[page.author].name %></h4>
-      <h5 class="PostAuthor-tagline"><%- site.data.authors[page.author].tagline %></h5>
-    </a>
-  </div>
   <br />
   <br />
   <%- partial('partials/comments') %>

+ 6 - 1
website/themes/uppy/source/css/_page.scss

@@ -344,11 +344,16 @@
   }
 }
 
-.PostAuthor {
+.PostAuthor:first-of-type {
   position: relative;
   margin-top: 40px;
 }
 
+.PostAuthor:not(:first-of-type) {
+  position: relative;
+  margin-top: 10px;
+}
+
 .PostAuthor-img {
   border-radius: 50%;
   max-width: 50px;