include tag with other liquid tag

369 views
Skip to first unread message

techwhizbang

unread,
Feb 24, 2010, 8:50:00 PM2/24/10
to Liquid Templates
Hey everyone,

I've written a custom liquid tag called CurrentLocale, and I can
access it and output it's value on my Liquid templates just fine using
{% current_locale %}.

However, I want to use this in conjunction with the built in include
tag. So I've been trying to use it this way:

{% include "{{ current_locale }}/some_partial_here" %}

I have tried it this way as well

{% include "{% current_locale %}/some_partial_here" %}

where current_locale points to a different directory where the partial
lives

Of course neither work, does any have anyone have an idea on a
solution?

Nick Pearson

unread,
Feb 24, 2010, 11:00:50 PM2/24/10
to liquid-t...@googlegroups.com
Capture the location into a variable, then use the variable in the include:

{% capture partial_location %}{% current_locale %}/some_partial_here{%
endcapture %}
{% include partial_location %}

> --
> You received this message because you are subscribed to the Google Groups "Liquid Templates" group.
> To post to this group, send email to liquid-t...@googlegroups.com.
> To unsubscribe from this group, send email to liquid-templat...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liquid-templates?hl=en.
>
>

techwhizbang

unread,
Feb 25, 2010, 11:31:20 AM2/25/10
to Liquid Templates
Yep that did the trick, thanks :)

On Feb 24, 8:00 pm, Nick Pearson <nick.pear...@gmail.com> wrote:
> Capture the location into a variable, then use the variable in the include:
>
> {% capture partial_location %}{% current_locale %}/some_partial_here{%
> endcapture %}
> {% include partial_location %}
>

Reply all
Reply to author
Forward
0 new messages