newblog/templates/shortcodes/showdata.html

19 lines
532 B
HTML
Raw Normal View History

2024-07-01 15:20:09 +02:00
{# showdata(src="../theme.toml" type="toml" key="min_version") #}
{%- if src and key and type %}
{%- if src is matching("^http[s]?://") %}
{% set data = load_data(url=src, format=type) %}
{%- else %}
{% set data = load_data(path=src, format=type) %}
{%- endif %}
{{ data[key] }}
{%- else %}
{# Load other file types as plain text #}
{%- if src is matching("^http[s]?://") %}
{% set data = load_data(url=src) %}
{%- else %}
{% set data = load_data(path=src) %}
{%- endif %}
{{ data }}
{%- endif %}