{% macro render(content, cms, config) %} {% import 'macros/elements/images.html' as images %} {# Set default classes and configuration #} {% set orientationClass = '' %} {% set imageDimensions = { 'width': 390, 'height': 219 } %} {% if config %} {# Sets the card into its horizontal layout #} {% if config.isHorizontal %} {% set orientationClass = ' coop-c-editorialcard--horizontal' %} {% endif %} {# move image to right #} {% set flipImage = '' %} {% if content.imagePositionRight %} {% set flipImage = ' coop-c-editorialcard--flip' %} {% endif %} {# If a two column layout we want to render a better sized image #} {% if config.twoColumns %} {% set imageDimensions = { 'width': 618, 'height': 348 } %} {% endif %} {% endif %}
{% if content.link and content.link.sys.id %} {% with link = cms.get_entry(content.link.sys.id) %} {% if link.type == 'internalLink' %} {% if link.fields.page.data %} {% with internalLink = cms.get_entry(link.fields.page.data.sys.id) %} {# Append full path if not home page #} {%- if internalLink.full_url_path == '/' -%} {%- set href = tenant_url_path -%} {%- else -%} {%- set href = tenant_url_path + internalLink.full_url_path -%} {%- endif -%} {# Strip trailing slash #} {%- set href = href.rstrip("/") -%} {# Append anchor if available #} {%- if link.fields.anchor and link.fields.anchor.data -%} {%- set href = href + "#" + link.fields.anchor.data -%} {%- endif -%} {% endwith %} {% endif %} {% elif link.type == 'externalLink' %} {% if link.fields.url.data %} {% endif %} {% endif %} {% endwith %} {% endif %}
{% if content.image and content.image.sys.id %} {% with image = cms.get_asset(content.image.sys.id) %}
{{ images.render(image, imageDimensions) }}
{% endwith %} {% endif %}
{%- if content.label -%}

{{ content.label }}

{%- endif -%}

{{ content.heading }}

{% if content.bodyText %}
{{ content.bodyText|markdown }}
{% endif %}
{% if content.link and content.link.sys.id %}
{% endif %}
{% endmacro %}