Last active
April 22, 2016 19:17
-
-
Save andrewfairlie/c41c685b3b3d6f7de060d55674eef276 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Define our macro #} | |
{% macro card(attributes) %} | |
{% if attributes.url %}<a href="{{ attributes.url }}">{% endif %} | |
<div class="card"> | |
{% if attributes.img %}<img src="{{ attributes.img }}">{% endif %} | |
<h2>{{ attributes.title }}</h2> | |
{{ attributes.content }} | |
</div> | |
{% if attributes.url %}</a>{% endif %} | |
{% endmacro %} | |
{# Import the macro, here we use _self but usually it'll be a separate file #} | |
{% import _self as ui %} | |
{# Output a detailed card #} | |
{{ ui.card( | |
{ | |
title: 'Card Title', | |
content: 'Hello World', | |
img: 'img.jpg', | |
url: 'index.html' | |
} | |
) }} | |
{# Output a simpler card #} | |
{{ ui.card( | |
{ | |
title: 'Card Title', | |
content: 'Hello World' | |
} | |
) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment