implied (non-specified) Jekyll layout

32 views
Skip to first unread message

Philip Durbin

unread,
Dec 10, 2011, 9:20:25 PM12/10/11
to jekyll.rb
For some of my Jekyll sites I'm always and only using "layout:
default". Can someone please tell me if there is a way to leave this
line out of my YAML Front Matter?

That is to say, I'd like to have. . .

---
title: My Title Here
---

. . . at the top of my page and have Jekyll always use the same
layout.

Thanks in advance for any suggestions.

Phil

Philip Durbin

unread,
Dec 14, 2011, 10:53:10 PM12/14/11
to jekyll.rb
On Dec 10, 9:20 pm, Philip Durbin <philipdur...@gmail.com> wrote:
> For some of my Jekyll sites I'm always and only using "layout:
> default".  Can someone please tell me if there is a way to leave this
> line out of my YAML Front Matter?
>
> That is to say, I'd like to have. . .
>
> ---
> title: My Title Here
> ---
>
> . . . at the top of my page and have Jekyll always use the same
> layout.

This hack allows me to leave "layout: default" out of my YAML Front
Matter:

[pdurbin@fedora gems]$ diff -Naur jekyll-0.11.0.orig jekyll-0.11.0
diff -Naur jekyll-0.11.0.orig/lib/jekyll/convertible.rb jekyll-0.11.0/
lib/jekyll/convertible.rb
--- jekyll-0.11.0.orig/lib/jekyll/convertible.rb 2011-11-05
00:16:44.325505039 -0400
+++ jekyll-0.11.0/lib/jekyll/convertible.rb 2011-12-14
22:27:04.370778491 -0500
@@ -31,6 +31,7 @@

begin
self.data = YAML.load($1)
+ self.data["layout"] = 'default'
rescue => e
puts "YAML Exception reading #{name}: #{e.message}"
end
[pdurbin@fedora gems]$

I have no plans to actually use this hacked version though; I'd like
my team to be able to use the standard version of Jekyll.

It would be nice to have the ability to put "layout: default" in
_config.yml and have all posts and pages use that layout unless it's
specified explicitly in the post or page. I wonder if this is
possible with a Jekyll plugin.

Phli

p.s. If you'd rather discuss this on Stack Overflow, I posted the
question and answer at
http://stackoverflow.com/questions/8490528/how-can-i-make-jekyll-use-a-layout-without-specifying-it

Reply all
Reply to author
Forward
0 new messages