浏览代码

Provide simple framework for doing blog post series (#1373)

* Provide simple framework for doing blog post series without overly spamming sidebars and such

This could definitely be prettier, but it works!

* DRY up a bit

* Remove the need for a custom layout when doing series

* Update website/src/_posts/2019-03-26-roadto10-day1.md

* Add the series name to the <title>

* Add more authors

* Don't publish just yet

* Update website/src/_data/authors.yml

* Update website/src/_posts/2019-03-26-roadto10-day1.md
Kevin van Zonneveld 6 年之前
父节点
当前提交
82df615ee1

+ 20 - 0
website/src/_data/authors.yml

@@ -8,6 +8,26 @@ ife:
   name: 'Ifedapo Olarewaju'
   name: 'Ifedapo Olarewaju'
   id: 'ife'
   id: 'ife'
   tagline: 'Software Developer'
   tagline: 'Software Developer'
+tyler:
+  email: 'tyler@transloadit.com'
+  name: 'Tyler McAllister'
+  id: tyler
+  tagline: 'Technical Writer'
+samuel:
+  email: 'samuel@transloadit.com'
+  name: 'Samuel Ogundipe'
+  id: samuel
+  tagline: 'Technical Writer'
+aj:
+  email: 'aj@transloadit.com'
+  name: 'A.J. van Loon'
+  id: aj
+  tagline: 'Writer & Editor' 
+kvz:
+  email: 'kevin@transloadit.com'
+  name: 'Kevin van Zonneveld'
+  id: kvz
+  tagline: 'Transloadit co-founder'
 renee:
 renee:
   email: 'github@kooi.me'
   email: 'github@kooi.me'
   name: 'Renée Kooi'
   name: 'Renée Kooi'

+ 20 - 0
website/src/_posts/2019-03-26-roadto10-day1.md

@@ -0,0 +1,20 @@
+---
+title: "Day 1"
+date: 2019-03-26
+author: kvz
+image: "https://uppy.io/images/blog/0.30/robodog-assemble.jpg"
+published: false
+series: The Road to 1.0
+---
+
+Hi all! Early 2016 [we started working on Uppy](/blog/2016/07/uppy-begins/), hoping to launch file uploading into a new age. The three years before that we've been laying the ground works with [tus.io](https://tus.io/), and we really felt that back-end power deserved a user-friendly front-end. We entertained the idea of a proprietary uploader but it didn't feel right. So as with Tus, we decided to open source it. Three years and 16 thousand stargazers later, we could not be happier. There's just one thing. Getting Uppy 1.0 out the door has been hard. Issue have been piling up which was hurting our capacity to make a push and hammer out the final design goals. 
+
+<!--more-->
+
+So in April, we're allocating all of Transloadit's resources to make a big push and get 1.0 out the door. Our goal is to launch on April 25th, exactly 30 days from now. Our Uppy core team (obviously), tus core team, sdk teams, infra engineers, designers, content writers, and founders, will all only work on Uppy 1.0 related tasks for the full month. We're even adding someone to the team (welcome [Evgenia Karunus](https://github.com/lakesare)! 🎉) to have extra capacity. We're adding all of the Uppy 1.0 tasks to a project board that we're evaluating each week, and that we'll even share with the world in a 30-day blog post series: "The Road to 1.0". You're reading the first post!
+
+A post each day may be hard to do, but we thought it's a fun challenge and it really fits with how we've been developing Uppy in an open way.
+
+Do let us know what you think and if you want to lend a hand! For one thing, issue busting will slow down as we are deep in React Native land, so we would sure appreciate any help we could get there!
+
+See you tomorrow for Day 2 on the Road to 1.0!

+ 10 - 0
website/src/_posts/2019-03-27-roadto10-day2.md

@@ -0,0 +1,10 @@
+---
+title: "Day 2"
+date: 2019-03-27
+author: kvz
+image: "https://uppy.io/images/blog/0.30/robodog-assemble.jpg"
+published: false
+series: The Road to 1.0
+---
+
+Howdy partners!

+ 5 - 0
website/themes/uppy/layout/layout.ejs

@@ -2,6 +2,11 @@
 <% var title = page.title ? page.title + ' — ' + config.title : config.title %>
 <% var title = page.title ? page.title + ' — ' + config.title : config.title %>
 <% var excerpt = page.excerpt ? page.excerpt.replace(/(<([^>]+)>)/ig, '').substring(0, 400) : config.description %>
 <% var excerpt = page.excerpt ? page.excerpt.replace(/(<([^>]+)>)/ig, '').substring(0, 400) : config.description %>
 <% var image = page.image ? page.image : 'http://uppy.io/images/uppy-social.jpg' %>
 <% var image = page.image ? page.image : 'http://uppy.io/images/uppy-social.jpg' %>
+<% 
+if (page.series) {
+  title = page.series + ': ' + page.title
+}
+%>
 
 
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">

+ 27 - 4
website/themes/uppy/layout/partials/blog.ejs

@@ -10,9 +10,26 @@
           </a>
           </a>
       </h2>
       </h2>
       <ul>
       <ul>
-      <% site.posts.sort('date', -1).limit(10).each(function (post) { %>
+        <% 
+        var seriesTracker = {}
+        var totalCnt = 0
+        site.posts.sort('date', -1).each(function (post) { 
+          var title = post.title
+          if (post.series) {
+            var title = post.series
+            if (!seriesTracker[post.series]) {
+              seriesTracker[post.series] = 0
+            }
+            seriesTracker[post.series]++
+          }
+          totalCnt++
+
+          if (totalCnt > 10 || seriesTracker[post.series] > 1) {
+            return false
+          }
+        %>
           <li>
           <li>
-              <a href="/<%- post.path %>" class="sidebar-link<%- page.title === post.title ? ' current' : '' %>"><%- post.title %></a>
+              <a href="/<%- post.path %>" class="sidebar-link<%- page.title === post.title ? ' current' : '' %>"><%- title %></a>
           </li>
           </li>
       <% }) %>
       <% }) %>
       </ul>
       </ul>
@@ -22,9 +39,15 @@
 
 
 <div class="Content js-Content with-sidebar">
 <div class="Content js-Content with-sidebar">
   <h1 style="text-align: center; margin-bottom:.5em">The <%- config.title %> Blog</h1>
   <h1 style="text-align: center; margin-bottom:.5em">The <%- config.title %> Blog</h1>
-  <% site.posts.sort('date', -1).each(function (post) { %>
+  <% site.posts.sort('date', -1).each(function (post) { 
+    var title = post.title
+
+    if (post.series) {
+      title = post.series + ': ' + post.title
+    }
+  %>
     <div class="post">
     <div class="post">
-      <h2><a href="/<%- post.path %>"><%- post.title %></a></h2>
+      <h2><a href="/<%- post.path %>"><%- title %></a></h2>
       <h4><%- post.date.format('MMM D[,] YYYY') %></h4>
       <h4><%- post.date.format('MMM D[,] YYYY') %></h4>
       <div><%- post.excerpt %></div>
       <div><%- post.excerpt %></div>
       <a href="/<%- post.path %>">Continue reading ...</a>
       <a href="/<%- post.path %>">Continue reading ...</a>

+ 24 - 0
website/themes/uppy/layout/partials/sidebar_blog_links.ejs

@@ -0,0 +1,24 @@
+<ul>
+  <% 
+    var seriesTracker = {}
+    var totalCnt = 0
+    site.posts.sort('date', -1).each(function (post) { 
+      var title = post.title
+      if (post.series) {
+        var title = post.series
+        if (!seriesTracker[post.series]) {
+          seriesTracker[post.series] = 0
+        }
+        seriesTracker[post.series]++
+      }
+      totalCnt++
+
+      if (totalCnt > 10 || seriesTracker[post.series] > 1) {
+        return false
+      }
+    %>
+  <li>
+    <a href="/<%- post.path %>" class="sidebar-link<%- page.title === post.title ? ' current' : '' %>"><%- title %></a>
+  </li>
+  <% }) %>
+</ul>

+ 14 - 7
website/themes/uppy/layout/post.ejs

@@ -9,20 +9,27 @@
                 <img src="/images/feed.png" style="width:15px;height:15px">
                 <img src="/images/feed.png" style="width:15px;height:15px">
             </a>
             </a>
         </h2>
         </h2>
-        <ul>
-        <% site.posts.sort('date', -1).limit(10).each(function (post) { %>
-            <li>
-                <a href="/<%- post.path %>" class="sidebar-link<%- page.title === post.title ? ' current' : '' %>"><%- post.title %></a>
-            </li>
-        <% }) %>
-        </ul>
+
+        <%- partial('partials/sidebar_blog_links') %>
         <%- partial('partials/social') %>
         <%- partial('partials/social') %>
     </div>
     </div>
 </div>
 </div>
 
 
+
 <div class="Content js-Content with-sidebar">
 <div class="Content js-Content with-sidebar">
   <h1><%- page.title %></h1>
   <h1><%- page.title %></h1>
   <h4><%- page.date.format('MMM D[,] YYYY') %></h4>
   <h4><%- page.date.format('MMM D[,] YYYY') %></h4>
+    <% 
+        if (page.series) { 
+            var seriesList = []
+            site.posts.sort('date', +1).each(function (post) { 
+                if (post.series === page.series) {
+                    seriesList.push('<a href="/' + post.path + '" class="postseries-link' + (page.title === post.title ? ' current' : '') + '">' + post.title + '</a>')
+                }
+            })
+        %>
+    <p><%- '↬ In this series: [ ' + seriesList.join(' | ') + ' ] ' %></p>
+    <% } %>
   <%- page.content %>
   <%- page.content %>
   <div class="PostAuthor">
   <div class="PostAuthor">
     <a href="https://transloadit.com/about/#<%- site.data.authors[page.author].id %>">
     <a href="https://transloadit.com/about/#<%- site.data.authors[page.author].id %>">

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

@@ -402,3 +402,9 @@
     color: $color-white;
     color: $color-white;
   }
   }
 }
 }
+
+.postseries-link {
+  &.current {
+    font-weight: 600;
+  }
+}