Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMike Hovet
147 PointsHelp creating defaults for _drafts
I am pretty sure I understand how to create defaults in Jekyll, but for some reason it's not working for my drafts.
here is my code:
In treehouse-meetups.md
title: Treehouse Meetups
category: meetups
This is a post about all the awesome Treehouse meetups out there!
in _config.yml
defaults:
-
scope:
path: "" # an empty string here means all files in the project
type: "posts" # previously post
in Jekyll 2.2.
values:
layout: "post"
author: "Mike Hovet"
category: "conferences"
comments: true
-
scope:
path: "" # an empty string here means all files in the project
type: "pages" # previously post
in Jekyll 2.2.
values:
layout: "page"
scope:
path: "" # an empty string here means all files in the project
type: "drafts" # previously `post` in Jekyll 2.2.
values:
layout: "post"
2 Answers
John Hampton
8,200 PointsDid you ever get this figured out? I'm wondering what the exact error is that you're seeing. I've more or less used the same format as you and it's working for me - here's what I've used:
# Default Settings
defaults:
-
scope:
path: "" # an empty string here means all files in the project
type: "posts" # previously `post` in Jekyll 2.2.
values:
author: John Hampton
layout: "post"
category: conferences
-
scope:
path: "" # an empty string here means all files in the project
type: "pages" # previously `post` in Jekyll 2.2.
values:
layout: "page"
-
scope:
path: "" # an empty string here means all files in the project
type: "drafts" # previously `post` in Jekyll 2.2.
values:
author: John Hampton
layout: "post"
category: conferences
Xkun Xu
5,478 PointsI had the same problem. But asking about 'Draft' before asking about 'Post' should solve this problem according to https://github.com/jekyll/jekyll/issues/2726