Template::LiquidX::Tag::Include - Include another file (Functioning Custom Tag Example)


    {% include '' %}


This is a demonstration of extending Template::Liquid.

If you find yourself using the same snippet of code or text in several templates, you may consider making the snippet an include.

You include static filenames...

    use Template::Liquid;
    use Template::LiquidX::Tag::Include;
    Template::Liquid->parse("{%include ''%}")->render();

...or 'dynamic' filenames (for example, based on a variable)...

    use Template::Liquid;
    use Template::LiquidX::Tag::Include;
    Template::Liquid->parse('{%include inc%}')->render(inc => '');


The default directory searched for includes is ./_includes/ but this can be changed in the include statement...

    use Template::LiquidX::Tag::Include '~/my_site/templates/includes';

This mimics Jekyll's include statement and was a 15m hack so it's subject to change ...and may be completly broken.

See Also

Liquid for Designers:

Template::Liquid's section on custom tags.


Sanko Robinson <> -

License and Legal

Copyright (C) 2009-2016 by Sanko Robinson <>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or For clarification, see

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See For clarification, see