{% extends 'layout.html.twig' %} {% block title %} {%- if author and (author.name ?? false) -%} {{ author.name }} - Nostr Event {%- else -%} Nostr Event {%- endif -%} {% endblock %} {% block ogtags %} {# Set og:type dynamically based on event kind #} {% set ogType = 'article' %} {% if event.kind == 21 or event.kind == 22 %} {% set ogType = 'video.other' %} {% elseif event.kind == 20 %} {% set ogType = 'article' %} {# Could use 'image' but 'article' is more widely supported #} {% endif %} {# OG Description - use event content or fallback #} {% set ogDescription = event.content|default('View this Nostr event')|striptags|slice(0, 200) %} {# URL #} {# Image - try to extract from event or use author image #} {% set ogImage = null %} {# For picture events (kind 20), try to get image from url tag #} {% if event.kind == 20 %} {% for tag in event.tags %} {% if tag[0] == 'url' and ogImage is null %} {% set ogImage = tag[1] %} {% endif %} {% endfor %} {% endif %} {# For video events (kind 21/22), try to get thumbnail #} {% if (event.kind == 21 or event.kind == 22) and ogImage is null %} {% for tag in event.tags %} {% if tag[0] == 'thumb' and ogImage is null %} {% set ogImage = tag[1] %} {% elseif tag[0] == 'image' and ogImage is null %} {% set ogImage = tag[1] %} {% endif %} {% endfor %} {% endif %} {# Fallback to author image if available #} {% if ogImage is null and author and (author.image ?? false) %} {% set ogImage = author.image %} {% endif %} {# Use default icon if no image found #} {% if ogImage is null %} {% set ogImage = app.request.schemeAndHttpHost ~ asset('icons/apple-touch-icon.png') %} {% endif %} {# Twitter Card tags #} {# Article metadata #} {% if event.created_at is defined %} {% endif %} {% if author and (author.name ?? false) %} {% endif %} {# Site name #} {% endblock %} {% block body %} {# Title from tags #} {% set title = 'Untitled' %} {% for tag in event.tags %} {% if tag[0] == 'title' %} {% set title = tag[1] %} {% endif %} {% endfor %}

{{ title }}

{% if author %} {% endif %}
{# NIP-68 Picture Event (kind 20) #} {% if event.kind == 20 %} {% include 'event/_kind20_picture.html.twig' %} {# NIP-71 Video Events (kind 21 and 22) #} {% elseif event.kind == 21 or event.kind == 22 %} {% include 'event/_kind22_video.html.twig' %} {% elseif event.kind == 1450 %} {% include 'event/_kind1450_tabular.html.twig' %} {% else %} {# Regular event content for non-picture and non-video events #}
{% endif %} {# Collect all imeta images into an array #} {% set images = [] %} {% for tag in event.tags %} {% if tag[0] == 'imeta' %} {% set imageUrl = null %} {% set mimeType = null %} {% set blurhash = null %} {% set dimensions = null %} {% set altText = null %} {% set fallbacks = [] %} {% set annotatedUsers = [] %} {# Parse imeta tag parameters #} {% for i in 1..(tag|length - 1) %} {% set param = tag[i] %} {% if param starts with 'url ' %} {% set imageUrl = param[4:] %} {% elseif param starts with 'm ' %} {% set mimeType = param[2:] %} {% elseif param starts with 'blurhash ' %} {% set blurhash = param[9:] %} {% elseif param starts with 'dim ' %} {% set dimensions = param[4:] %} {% elseif param starts with 'alt ' %} {% set altText = param[4:] %} {% elseif param starts with 'fallback ' %} {% set fallbacks = fallbacks|merge([param[9:]]) %} {% elseif param starts with 'annotate-user ' %} {% set annotatedUsers = annotatedUsers|merge([param[14:]]) %} {% endif %} {% endfor %} {# Alt is also own tag #} {% for altTag in event.tags %} {% if altTag[0] == 'alt' %} {% set altText = altTag[1] %} {% endif %} {% endfor %} {% set images = images|merge([{ 'url': imageUrl, 'mimeType': mimeType, 'blurhash': blurhash, 'dimensions': dimensions, 'altText': altText, 'fallbacks': fallbacks, 'annotatedUsers': annotatedUsers }]) %} {% endif %} {% endfor %} {% if images|length > 0 %} {% endif %}
{% if is_granted('ROLE_ADMIN') and nostrLinks is defined and nostrLinks|length > 0 %} {% endif %}
{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %}