help with layouts

3 views
Skip to first unread message

purpletonic

unread,
Mar 24, 2010, 12:24:32 PM3/24/10
to Webby
Can anyone elaborate on how layouts work?

I've gone through the documentation, and as far I can tell I'm doing
it to the book, but none of my layouts are being picked up. I must be
doing something wrong, but I can't spot it.

I have two layouts in my layouts folder: 'default.txt' and
'film-1.txt'. Within my content folder, I have a file called index.txt
which has the following meta data:
---
layout: film-1
title: Film
created_at: 2010-03-23 16:06:18.573516 +00:00
filter:
- erb
---

Whenever I run the webby command, the index file always uses the
default template. How do I stop it from doing this, and get it using
the film template? Is there a command I need to run to initialise the
template?

Cheers,
Rich

aimee daniells

unread,
Mar 24, 2010, 1:53:27 PM3/24/10
to webby...@googlegroups.com
It sounds to me as if you're doing it right.

It's possible it might be the hyphen that's causing a problem. Try renaming it to 'film1' and see if it makes any difference. I've seen problems with hyphens and underscores in some places.

aimee


To unsubscribe from this group, send email to webby-forum+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

purpletonic

unread,
Mar 25, 2010, 5:10:05 AM3/25/10
to Webby
Hi Aimee, thanks for the reply.

Still not having any luck though. What's more, if I move the layout
declaration anywhere else in the meta area except the top, I get an
error upon running 'webby rebuild'. e.g. with this code:

---


title: Film
created_at: 2010-03-23 16:06:18.573516 +00:00

layout: film1
filter:
- erb
---

I get this error:

ERROR: error loading file "content/index.txt"
ERROR: <Webby::Resources::MetaFile::Error> corrupt meta-data (perhaps
there is an errant YAML marker '---' in the file)
-- syntax error on line 4, col 0: `filter:'
/var/lib/gems/1.8/gems/webby-0.9.4/lib/webby/resources/meta_file.rb:
151:in `each'

Any ideas what might be causing this?

On Mar 24, 5:53 pm, aimee daniells <aimeedanie...@googlemail.com>
wrote:


> It sounds to me as if you're doing it right.
>
> It's possible it might be the hyphen that's causing a problem. Try renaming
> it to 'film1' and see if it makes any difference. I've seen problems with
> hyphens and underscores in some places.
>
> aimee
>

Tim Pease

unread,
Mar 25, 2010, 11:27:23 AM3/25/10
to webby...@googlegroups.com

On Mar 25, 2010, at 3:10 AM, purpletonic wrote:

> Hi Aimee, thanks for the reply.
>
> Still not having any luck though. What's more, if I move the layout
> declaration anywhere else in the meta area except the top, I get an
> error upon running 'webby rebuild'. e.g. with this code:
>
> ---
> title: Film
> created_at: 2010-03-23 16:06:18.573516 +00:00
> layout: film1
> filter:
> - erb
> ---
>
> I get this error:
>
> ERROR: error loading file "content/index.txt"
> ERROR: <Webby::Resources::MetaFile::Error> corrupt meta-data (perhaps
> there is an errant YAML marker '---' in the file)
> -- syntax error on line 4, col 0: `filter:'
> /var/lib/gems/1.8/gems/webby-0.9.4/lib/webby/resources/meta_file.rb:
> 151:in `each'
>
> Any ideas what might be causing this?
>

Webby is not a big fan of UTF8 characters. Make sure that your YAML delimiters (the three dashes) are really ascii characters; trailing whitespace is okay.

Blessings,
TwP

Tim Pease

unread,
Mar 25, 2010, 11:29:46 AM3/25/10
to webby...@googlegroups.com

On Mar 24, 2010, at 11:53 AM, aimee daniells wrote:

> It sounds to me as if you're doing it right.
>
> It's possible it might be the hyphen that's causing a problem. Try renaming
> it to 'film1' and see if it makes any difference. I've seen problems with
> hyphens and underscores in some places.
>

You can also quote the layout name

layout: "flim-1"

That will force it into a string. When all else fails, peruse the YAML spec http://www.yaml.org/ for the acceptable characters for strings, numerics, etc.

Blessings,
TwP

Reply all
Reply to author
Forward
0 new messages