Skip to content

Instantly share code, notes, and snippets.

Last active October 18, 2020 14:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kieranbarker/95b1535449624efc834ab96dd288cfa4 to your computer and use it in GitHub Desktop.
Prevent draft and scheduled posts from being written to output in Eleventy
module.exports = {
layout: 'layouts/post.html',
eleventyComputed: {
permalink(data) {
if (!data.draft && new Date( <= new Date()) {
return data.permalink || '/blog/{{ title | slug }}/index.html';
return false;
Copy link

kieranbarker commented Oct 18, 2020

Line 6 assumes you're using Nunjucks and/or Liquid as your template language(s).

This directory data should be used in conjunction with the following collection in your Eleventy config file:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment