Created
January 31, 2018 10:56
-
-
Save federicomichela/4fe321aee5695cbf57d98b843cba0f92 to your computer and use it in GitHub Desktop.
JINJA2 - Set conditional variables ( Macros )
This file contains 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
{% macro _page_title() -%} | |
{% block page_title %} | |
{% if page_id == 'some-string' %} | |
{% trans %}Some String{% endtrans %} | |
{% elif page_id == 'some-other-string' %} | |
{% trans %}Some Other String{% endtrans %} | |
{% else %} | |
{% trans %}General String{% endtrans %} | |
{% endif %} | |
{% endblock %} | |
{%- endmacro %} | |
{% set page_title = _page_title() %} | |
<h4>{{page_title}}</h4> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment