Skip to content

Instantly share code, notes, and snippets.

@andrewfairlie
Last active April 22, 2016 19:17
Show Gist options
  • Save andrewfairlie/c6756a7baea972312ea028faaa83cab8 to your computer and use it in GitHub Desktop.
Save andrewfairlie/c6756a7baea972312ea028faaa83cab8 to your computer and use it in GitHub Desktop.
{# Define our macro #}
{% macro card(title,content,img,url) %}
{% if url %}<a href="{{ url }}">{% endif %}
<div class="card">
{% if img %}<img src="{{ img }}">{% endif %}
<h2>{{ title }}</h2>
{{ content }}
</div>
{% if url %}</a>{% endif %}
{% endmacro %}
{# Import the macro, here we use _self but usually it'll be a separate file #}
{% import _self as ui %}
{# Output the profile #}
{{ ui.card('Card Title','Hello World','image.jpg','index.html') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment