{# Display a card for content based on slug with optional parameter overrides #} {% macro card(slug, image="", title="", text="", content_type="") %} {% if slug is starting_with("http://") or slug is starting_with("https://") %} {# External URL - skip data lookup and use provided parameters #} {% if image %} {% set final_image = image %} {% else %} {% set final_image = "" %} {% endif %} {% if title %} {% set final_title = title %} {% else %} {% set final_title = "Link" %} {% endif %} {% if text %} {% set final_text = text %} {% else %} {% set final_text = "External Link" %} {% endif %} {% if content_type %} {% set final_content_type = content_type %} {% else %} {% set final_content_type = "Link" %} {% endif %} {% set final_url = slug %} {% set target_blank = true %} {% else %} {# Internal content - perform data lookup #} {% set data = get_data_by_slug(slug=slug) %} {% if image %} {% set final_image = image %} {% else %} {% set final_image = data.image %} {% endif %} {% if title %} {% set final_title = title %} {% else %} {% set final_title = data.title %} {% endif %} {% if text %} {% set final_text = text %} {% else %} {% set final_text = data.text %} {% endif %} {% if content_type %} {% set final_content_type = content_type %} {% else %} {% set final_content_type = data.content_type %} {% endif %} {% set final_url = url_for(path=data.slug ~ ".html") %} {% set target_blank = false %} {% endif %}
{{ final_title }}
{{ final_content_type }}
{{ final_title }}
{{ final_text }}
{% endmacro card %}