{% extends 'base.html.twig' %} {% trans_default_domain "Social" %} {# --- Compute SEO variables once --- #} {% set authorName = post.user.firstName ~ ' ' ~ post.user.lastName %} {% set postSnippet = post.contentPreview(200)|striptags %} {# Determine best title and description depending on post type #} {% if post.sharedResearch %} {% set seoTitle = authorName ~ ' — ' ~ (post.sharedResearch.arabicFullTitle ?: post.sharedResearch.englishFullTitle) %} {% set seoDescription = postSnippet ?: (post.sharedResearch.arabicAbstract ?: post.sharedResearch.englishAbstract)|striptags|slice(0, 200) %} {% elseif resolvedPaper is defined and resolvedPaper %} {% set seoTitle = authorName ~ ' — ' ~ resolvedPaper.title %} {% set seoDescription = postSnippet ?: resolvedPaper.abstract|striptags|slice(0, 200) %} {% else %} {% set seoTitle = authorName ~ ': ' ~ postSnippet|slice(0, 80) %} {% set seoDescription = postSnippet %} {% endif %} {# Author image (absolute URL) #} {% set seoImage = app.request.schemeAndHttpHost ~ post.user.webPath %} {# Post image overrides author avatar when available #} {% if post.image %} {% set seoImage = app.request.schemeAndHttpHost ~ '/uploads/posts/' ~ post.image %} {% endif %} {% set postUrl = app.request.schemeAndHttpHost ~ path('show_profile_post', {'slug': post.slug}) %} {# --- Page Title --- #} {% block title %}{{ seoTitle }}{% endblock %} {# --- Meta Description --- #} {% block metaDescription %}{{ seoDescription|slice(0, 160) }}{% endblock %} {# --- OpenGraph --- #} {% block fb_open_graph %} {% endblock %} {# --- Twitter Card --- #} {% block twitter_cards %} {% endblock %} {# --- Canonical URL --- #} {% block canonical_url %} {% endblock %} {# --- Structured Data (JSON-LD) --- #} {% block structured_data %} {% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block body %}
{{ 'social.back_to_feed'|trans }} {# Post Detail Card #} {% set author = post.user %}
{% if post.isPinned %} {{ 'social.pinned'|trans }} {% endif %} {% if post.sharedResearch or (resolvedPaper is defined and resolvedPaper) %} {{ 'social.paper_shared'|trans }} {% endif %} {% if app.user is not null and app.user.id == post.user.id %}
{% endif %}
{# Render research chat posts with HTML, others escaped #} {% if post.content starts with '
' %}
{{ post.content|raw }}
{% else %}
{{ post.content }}
{% endif %} {% if post.image %} {% endif %} {% if post.sharedResearch %} {% set research = post.sharedResearch %}
{{ research.arabicFullTitle ?: research.englishFullTitle }}
{% set abstract = research.arabicAbstract ?: research.englishAbstract %} {% if abstract %}

{{ abstract|striptags|slice(0, 200) }}

{% endif %} {{ 'social.research'|trans }}
{% elseif resolvedPaper is defined and resolvedPaper %}
{{ resolvedPaper.title }}
{% if resolvedPaper.abstract %}

{{ resolvedPaper.abstract }}

{% endif %} {{ 'social.research'|trans }}
{% elseif post.sharedUrl %} {% if post.hasLinkPreview %} {% if post.linkPreviewImage %} {% endif %} {% else %}
{{ post.sharedUrl }}
{{ 'social.external_link'|trans }}
{% endif %} {% endif %}
{{ post.likesCount }} {{ 'social.likes'|trans }} {{ post.commentsCount }} {{ 'social.comments'|trans }} {{ post.views }} {{ 'social.views'|trans }}
{# Comments Section #}

{{ 'social.comments'|trans }}

{{ post.commentsCount }}
{# Comment Composer #} {% if currentUser %}
{% endif %} {# Comments List #}
{% endblock %} {% block javascripts %} {{ parent() }}

{{ 'social.edit_post'|trans }}

{% endblock %}