Macro in liquid pattern language

I use Jekyll, which uses the Liquid Template language. I have used the Jinja template in the past and it has the concept of macro (only a named function). Does the fluid have something that provides equivalent functionality? If not, is there any Jekyll plugin that will extend Liquid to provide it?

+4
source share
2 answers

You can create objects that take parameters. This is not exactly a macro, but it is what I have successfully used on GitHub pages.

For more information and tips on managing the inclusion and use of parameters, see the Jekyll documentation .

:

_includes/email_link.html

<a href="mailto:{{ include.user.email_address }}"
   title="Email {{ include.user.name }}">
    <i class="fa fa-fw fa-envelope"></i>
</a>

about.md

---
layout: page
title: About
---
{% include email_link.html user=site.users.erik %}

_config.yml

users:
    erik:
        name: Erik
        email_address: erik.gillespie@wizbang.com
+7

, Jekyll .

+2

All Articles