{% macro render(post, is_index, post_extra_class) %} {% set headlessPost = Array.prototype.indexOf.call(['quote', 'picture'], post.type) > -1 %} {% set post_class = 'post post-type-' + post.type | default('normal') %} {% if post_extra_class > 0 %} {% set post_class = post_class + ' ' + post_extra_class | default('') %} {% endif %} {% if post.sticky > 0 %} {% set post_class = post_class + ' ' + 'post-sticky' %} {% endif %}
{##################} {### POST BLOCK ###} {##################}
{% if not headlessPost %}
{# Not to show title for quote posts that do not have a title #} {% if not (is_index and post.type === 'quote' and not post.title) %} <{% if theme.seo %}h2{% else %}h1{% endif %} class="post-title{% if post.direction && post.direction.toLowerCase() === 'rtl' %} rtl{% endif %}" itemprop="name headline">{# #}{# Link posts #}{# #}{% if post.link %} {% if post.sticky > 0 %} {{ post.sticky }} {% endif %} {% else %}{# #}{% if is_index %} {% if post.sticky > 0 %} {% endif %} {# #}{% else %}{{ post.title }}{% endif %}{# #}{% endif %}{# #} {% endif %}
{% endif %} {#################} {### POST BODY ###} {#################}
{# Gallery support #} {% if post.photos and post.photos.length %}
{% set COLUMN_NUMBER = 3 %} {% for photo in post.photos %} {% if loop.index0 % COLUMN_NUMBER === 0 %}
{% endif %} {% if loop.index0 % COLUMN_NUMBER === 2 %}
{% endif %} {% endfor %} {# Append end tag for `post-gallery-row` when (photos size mod COLUMN_NUMBER) is less than COLUMN_NUMBER #} {% if post.photos.length % COLUMN_NUMBER > 0 %}
{% endif %}
{% endif %} {% if is_index %} {% if post.description and theme.excerpt_description %} {{ post.description }}
{{ __('post.read_more') }} »
{% elif post.excerpt %} {{ post.excerpt }}
{{ __('post.read_more') }} »
{% elif theme.auto_excerpt.enable %} {% set content = post.content | striptags %} {{ content.substring(0, theme.auto_excerpt.length) }} {% if content.length > theme.auto_excerpt.length %}...{% endif %}
{{ __('post.read_more') }} »
{% else %} {% if post.type === 'picture' %} {{ post.content }} {% else %} {{ post.content }} {% endif %} {% endif %} {% else %} {{ post.content }} {% endif %}
{#####################} {### END POST BODY ###} {#####################} {% if theme.wechat_subscriber.enabled and not is_index %}
{% include 'wechat-subscriber.swig' %}
{% endif %} {% if (theme.alipay or theme.wechatpay or theme.bitcoin) and not is_index %}
{% include 'reward.swig' %}
{% endif %} {% if theme.post_copyright.enable and not is_index %}
{% include 'post-copyright.swig' with { post: post } %}
{% endif %} {######################} {### END POST BLOCK ###} {######################}
{% endmacro %}