How to display future posts using Jekyll

I wrote a plugin to display future posts during recent Jekyll upgrade. As you can see it is used on the main page, so I will share it with you.

Jekyll - Incoming posts

The main part of the process is to store parsed future posts as a snippet and then include it on the main page.

Create future_list.rb plugin to get and store future posts.

$ cat _plugins/future_list.rb
module Jekyll
  class FutureList < Page
    def initialize(site, base, dir, posts)
      @site = site
      @base = base
      @dir  = dir
      @name = 'future.html'

      self.read_yaml(File.join(base, '_layouts'), 'future_list.html')['posts'] = posts

  class FutureListGenerator < Generator
    safe true

    def generate(site)
      if site.layouts.key? 'topic_list'
        config = site.config
        config["future"] = true

        newsite =; do |entry|
          if >
            posts[entry["date"]] = entry["title"]

        dir = 'snippets'
        write_future_list(site, dir, posts)

    def write_future_list(site, dir, topics)
      index =, site.source, dir, topics)
      index.render(site.layouts, site.site_payload)
      site.pages << index

Create simple future_list.html layout file for future posts.

$ cat _layouts/future_list.html
layout: null
<div class="post-wrap">
  <div class="post-inner">
    <div class="entry-content">
      {% for post in page.posts limit: 5 %}
        <p><strong>{{ post[1] }}</strong><br/> <em>scheduled for {{ post[0] | date_to_string }}</em></p>
      {% endfor %}
    <div class="clearfix"></div>
  </div><!-- End post-inner -->
</div><!-- End post-wrap -->
Use this layout to to customize the look and define number of posts (5 in this example).

Modify main index.html to include created snippet.

<h2 class="page-title">Upcoming posts</h2>

{% include_relative _site/snippets/future/index.html %}		    

Rebuild the site and enjoy.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.