{% if on_rtd %} {% if rtd_version == 'latest' %} {% elif rtd_version == 'stable' %} {% else %} {% endif %} {%- else %} {# not on rtd #} {%- endif %}