{# Import smart link macro for intelligent URL handling #} {% import "../../includes/macros/smart-link.html" as links %} {% set c = module.content %} {% set s = module.style %} {% set colors = module.colors %} {% set spacing = module.spacing %} {% set a = module.advanced %} {# Build CSS classes #} {% set module_classes = "split-content" %} {% set module_classes = module_classes ~ " split-content--media-" ~ c.media_position %} {% if s.stack_on_mobile %} {% set module_classes = module_classes ~ " split-content--stack" %} {% endif %} {% if s.reverse_stack %} {% set module_classes = module_classes ~ " split-content--reverse-stack" %} {% endif %} {% if a.custom_class %} {% set module_classes = module_classes ~ " " ~ a.custom_class %} {% endif %} {# Image URL handling #} {% if c.media_type == "image" and c.image and c.image.src %} {% set img_raw = c.image.src %} {% if '../../images/' in img_raw %} {% set img_url = get_asset_url(img_raw) %} {% else %} {% set img_url = img_raw %} {% endif %} {% set img_width = c.image.width|default(600) %} {% set img_height = c.image.height|default(400) %} {% endif %} {# Video thumbnail handling #} {% if c.media_type == "video" and c.video_thumbnail and c.video_thumbnail.src %} {% set thumb_raw = c.video_thumbnail.src %} {% if '../../images/' in thumb_raw %} {% set thumb_url = get_asset_url(thumb_raw) %} {% else %} {% set thumb_url = thumb_raw %} {% endif %} {% endif %} {# Parse video URL for embed #} {% if c.media_type == "video" and c.video_url %} {% set video_id = "" %} {% set video_platform = "" %} {% if "youtube.com" in c.video_url or "youtu.be" in c.video_url %} {% set video_platform = "youtube" %} {% if "v=" in c.video_url %} {% set video_id = c.video_url|split("v=")|last|split("&")|first %} {% elif "youtu.be/" in c.video_url %} {% set video_id = c.video_url|split("youtu.be/")|last|split("?")|first %} {% endif %} {% elif "vimeo.com" in c.video_url %} {% set video_platform = "vimeo" %} {% set video_id = c.video_url|split("vimeo.com/")|last|split("?")|first %} {% endif %} {% endif %}
{# Media Column #}
{% if c.media_type == "image" and img_url %} {{ c.image.alt|default('', true)|escape }} {% elif c.media_type == "video" and video_id %}
{# Facade pattern: show thumbnail until click #}
{% elif c.media_type == "code" and c.code_content %}
{{ c.code_content|escape }}
{% endif %}
{# Content Column #}
{% if c.eyebrow %}

{{ c.eyebrow|escape }}

{% endif %} <{{ c.heading_level }} class="split-content__heading">{{ c.heading|escape }} {% if c.body_content %}
{{ c.body_content }}
{% endif %} {# CTAs - Using smart link macro for intelligent URL handling. Either CTA can render on its own; each guards on its own .url.href. #} {% if (c.cta_primary.text and c.cta_primary.url.href) or (c.cta_secondary.text and c.cta_secondary.url.href) %}
{% if c.cta_primary.text and c.cta_primary.url.href %} {{ c.cta_primary.text|escape }} {% endif %} {% if c.cta_secondary.text and c.cta_secondary.url.href %} {{ c.cta_secondary.text|escape }} {% endif %}
{% endif %}
{% require_css %} {% end_require_css %} {# Video facade script - only included when video is present #} {% if c.media_type == "video" and video_id %} {% require_js position="footer" defer=true %} {% end_require_js %} {% endif %}