{%- macro expandURL(url, resource=False) -%} {%- if url.startswith(('https://', 'http://')) -%} {{ url }} {%- else -%} {{ pathto(url, resource=resource) }} {%- endif -%} {%- endmacro -%}