You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
688 B
HTML

{#- load_data uses different arguments based on whether it's a remote or local file -#}
{%- if src is starting_with("http") -%}
{%- set response = load_data(url=src, format="plain") -%}
{%- else -%}
{#- Try to load the file from a relative path -#}
{%- set colocated_path = page.colocated_path | default(value="") -%}
{%- set relative_path = colocated_path ~ src -%}
{%- set response = load_data(path=relative_path, format="plain", required=false) -%}
{#- If relative path fails, try absolute path -#}
{%- if not response -%}
{%- set response = load_data(path=src, format="plain") -%}
{%- endif -%}
{%- endif -%}
{{- response | trim_end | safe -}}