Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Last active March 3, 2021 22:18
Show Gist options
  • Save greggnakamura/1177d9c0d0ed517b071aa4a5302087a5 to your computer and use it in GitHub Desktop.
Save greggnakamura/1177d9c0d0ed517b071aa4a5302087a5 to your computer and use it in GitHub Desktop.
Nunjucks: Random code samples
{# render component #}
{% render '@carousel' %}
{# render component with arguments #}
{% render '@hyperlink', {
url: '/path/to/page',
link_text: 'Learn more',
aria_label: 'Learn more about this item',
target: '_blank',
aria_describedby: 'new-window' }
%}
{# -------------------- #}
{# if #}
{% if variable %}
...
{% elif tired %}
...
{% else %}
...
{% endif %}
{# -------------------- #}
{# for #}
{% for slide in slides %}
...
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment