Last active
October 20, 2017 11:19
-
-
Save benjaminsnorris/1248c19efce6da007d5017d7b3cfaf1e to your computer and use it in GitHub Desktop.
Jekyll changes to support public drafts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
collections: | |
drafts: | |
output: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults: | |
- | |
scope: | |
path: "" | |
type: drafts | |
values: | |
layout: draft |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: post | |
meta_robots: noindex | |
--- | |
{{ content }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: page | |
title: Drafts | |
permalink: /drafts/ | |
meta_robots: noindex | |
--- | |
<p>These are draft posts for previewing.</p> | |
<div class="posts"> | |
{% assign sorted = (site.drafts | sort: 'date') | reverse %} | |
{% for draft in sorted %} | |
<div class="post py2"> | |
<p class="post-meta h5">{{ draft.date | date: site.date_format }}</p> | |
<a href="{{ draft.url }}" class="post-link"><h3 class="post-title">{{ draft.title }}</h3></a> | |
{% if draft.categories.size > 0 %} | |
<span class="post-meta small"> | |
{% for category in draft.categories %} | |
<a href="{{ category }}" class="category">{{ category }}</a> | |
{% endfor %} | |
</span> | |
{% endif %} | |
</div> | |
{% endfor %} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if page.meta_robots %} | |
<meta name="robots" content="{{ page.meta_robots }}"> | |
{% elsif layout.meta_robots %} | |
<meta name="robots" content="{{ layout.meta_robots }}"> | |
{% else %} | |
<meta name="robots" content="all"> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, this has helped me a lot!
I had to make the following changes though:
draft.html
line 9: I had to remove the parenthesis as I was getting a Liquid warningheader.html
file under_includes
and change it to the following: