- {% 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 %}
+ {% include 'partial/_gallery.html.twig' with {event: event, isEmbed: isEmbed} %}
{# Location data #}
{% set location = null %}
diff --git a/templates/event/index.html.twig b/templates/event/index.html.twig
index b3a81df..4eef17a 100644
--- a/templates/event/index.html.twig
+++ b/templates/event/index.html.twig
@@ -120,104 +120,7 @@
- {# 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 %}
-
-
- {% set main = images[0] %}
-
-
-
- {% for fallback in main.fallbacks %}
-
- {% endfor %}
-
-
- {% if images|length > 1 %}
-
- {% for img in images %}
-

- {% endfor %}
-
- {% endif %}
-
- {# Display annotated users for main image #}
- {% if main.annotatedUsers|length > 0 %}
-
- {% for userAnnotation in main.annotatedUsers %}
- {% set parts = userAnnotation|split(':') %}
- {% if parts|length == 3 %}
-
-
-
- {% endif %}
- {% endfor %}
-
- {% endif %}
-
-
- {% endif %}
+ {% include 'partial/_gallery.html.twig' with {event: event, isEmbed: false} %}
{% endif %}
diff --git a/templates/pages/author-about.html.twig b/templates/pages/author-about.html.twig
index bde8034..20627cc 100644
--- a/templates/pages/author-about.html.twig
+++ b/templates/pages/author-about.html.twig
@@ -2,7 +2,7 @@
{% block body %}
- {% import 'partial/_author-section.html.twig', {author: author, npub: npub} %}
+ {% include 'partial/_author-section.html.twig' with {author: author, npub: npub} %}
diff --git a/templates/pages/author-media.html.twig b/templates/pages/author-media.html.twig
index 6268a28..e1791c5 100644
--- a/templates/pages/author-media.html.twig
+++ b/templates/pages/author-media.html.twig
@@ -2,7 +2,7 @@
{% block body %}
- {% import 'partial/_author-section.html.twig', {author: author, npub: npub} %}
+ {% include 'partial/_author-section.html.twig' with {author: author, npub: npub} %}
diff --git a/templates/pages/author.html.twig b/templates/pages/author.html.twig
index 8017670..7e3ae5d 100644
--- a/templates/pages/author.html.twig
+++ b/templates/pages/author.html.twig
@@ -2,7 +2,7 @@
{% block body %}
- {% import 'partial/_author-section.html.twig', {author: author, npub: npub} %}
+ {% include 'partial/_author-section.html.twig' with {author: author, npub: npub} %}
{% endblock %}
-
diff --git a/templates/partial/_gallery.html.twig b/templates/partial/_gallery.html.twig
new file mode 100644
index 0000000..dbbf393
--- /dev/null
+++ b/templates/partial/_gallery.html.twig
@@ -0,0 +1,131 @@
+ {# 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 %}
+
+ {# 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 %}