{#- Feed utility macros -#}

{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#}
{%- macro get_generate_feed() -%}
    {{- config.generate_feeds | default(value=config.generate_feed) -}}
{%- endmacro get_generate_feed -%}

{%- macro get_feed_url() -%}
    {{- config.feed_filenames[0] | default(value=(config.feed_filename)) -}}
{%- endmacro get_feed_url -%}

{#- Check footer feed icon conditions -#}
{%- macro should_show_footer_feed_icon() -%}
    {%- set generate_feed = feed_utils::get_generate_feed() == "true" -%}
    {%- set feed_url = feed_utils::get_feed_url() -%}
    {{- generate_feed and config.extra.feed_icon and feed_url -}}
{%- endmacro should_show_footer_feed_icon -%}

{#- Get feed icon name: string value or "rss" for true, empty for false -#}
{%- macro get_feed_icon_name() -%}
    {%- if config.extra.feed_icon is string -%}
        {{- config.extra.feed_icon -}}
    {%- elif config.extra.feed_icon -%}
        {{- "rss" -}}
    {%- endif -%}
{%- endmacro get_feed_icon_name -%}
