{# Title tag #}
{% set title = null %}
{% for tag in event.tags %}
{% if tag[0] == 'title' %}
{% set title = tag[1] %}
{% endif %}
{% endfor %}
{% if title %}
{{ title }}
{% endif %}
{# Content warning #}
{% set contentWarning = null %}
{% for tag in event.tags %}
{% if tag[0] == 'content-warning' %}
{% set contentWarning = tag[1] %}
{% endif %}
{% endfor %}
{% if contentWarning %}
⚠️ Content Warning: {{ contentWarning }}
{% else %}
{% endif %}
{# Display videos from imeta tags #}
{% for tag in event.tags %}
{% if tag[0] == 'imeta' %}
{% set videoUrl = null %}
{% set mimeType = null %}
{% set dimensions = null %}
{% set altText = null %}
{% set previewImage = null %}
{% set fallbacks = [] %}
{# Parse imeta tag parameters #}
{% for i in 1..(tag|length - 1) %}
{% set param = tag[i] %}
{% if param starts with 'url ' %}
{% set potentialUrl = param[4:] %}
{# Check if it's a video URL #}
{% if potentialUrl matches '/\\.(mp4|webm|ogg|mov)$/i' or potentialUrl matches '/video/i' %}
{% set videoUrl = potentialUrl %}
{% endif %}
{% elseif param starts with 'image ' %}
{% set previewImage = param[6:] %}
{% elseif param starts with 'm ' %}
{% set mimeType = param[2:] %}
{% elseif param starts with 'dim ' %}
{% set dimensions = param[4:] %}
{% elseif param starts with 'alt ' %}
{% set altText = param[4:] %}
{% elseif param starts with 'fallback ' %}
{% set fallbackUrl = param[9:] %}
{# Only add video fallbacks #}
{% if fallbackUrl matches '/\\.(mp4|webm|ogg|mov)$/i' or fallbackUrl matches '/video/i' %}
{% set fallbacks = fallbacks|merge([fallbackUrl]) %}
{% endif %}
{% endif %}
{% endfor %}
{% if videoUrl %}
{% if altText %}
{{ altText }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{# Description from content #}
{% if event.content %}
{% endif %}
{# Duration #}
{% set duration = null %}
{% for tag in event.tags %}
{% if tag[0] == 'duration' %}
{% set duration = tag[1] %}
{% endif %}
{% endfor %}
{% if duration %}