How to apply filters to layouts?

37 views
Skip to first unread message

Iñaki Baz Castillo

unread,
Sep 19, 2012, 7:08:55 PM9/19/12
to na...@googlegroups.com
Hi, I need to apply a custom filter :my_filter to
layouts/default.html, but also need :erb. How to include that within
Rules?:


### layout rules
layout "*", :erb


¿?


Thanks a lot.


--
Iñaki Baz Castillo
<i...@aliax.net>

justin

unread,
Sep 19, 2012, 7:34:26 PM9/19/12
to na...@googlegroups.com
The filter on a layout isn't quite the same as filters on items. The
layout filter is more like "this is the engine to use to apply this
layout to an item"... As such, you should only need one. But you can
apply as many filters as you want to items, before and after laying
them out. For example, here's the rule for compiling an article on my
blog:

compile '/article/*' do
filter :erb
filter :kramdown
filter :colorize_syntax

layout item[:content_type] || 'post'
layout 'article'

filter :fast_aleck

layout 'content'
layout 'default'
end

The :fast_aleck filter is applied to the item after laying it out with
both the 'post' and 'article' layouts.

--j
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en



--
http://justinhileman.com

Iñaki Baz Castillo

unread,
Sep 20, 2012, 11:28:24 AM9/20/12
to na...@googlegroups.com
Thanks a lot. It's clear.

2012/9/20 justin <jus...@justinhileman.info>:
> The filter on a layout isn't quite the same as filters on items. The
> layout filter is more like "this is the engine to use to apply this
> layout to an item"... As such, you should only need one. But you can
> apply as many filters as you want to items, before and after laying
> them out. For example, here's the rule for compiling an article on my
> blog:
>
> compile '/article/*' do
> filter :erb
> filter :kramdown
> filter :colorize_syntax
>
> layout item[:content_type] || 'post'
> layout 'article'
>
> filter :fast_aleck
>
> layout 'content'
> layout 'default'
> end
>
> The :fast_aleck filter is applied to the item after laying it out with
> both the 'post' and 'article' layouts.



Reply all
Reply to author
Forward
0 new messages