{% 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 %} {% if theme.reading_progress.enable && not is_index %}
{% 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 %} {% set postTitleIcon = '' %} {% set postText = post.title or post.link %} {{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }} {% else %}{# #}{% if is_index %} {% if post.sticky > 0 %} {% endif %} {# Need to delete maybe? #} {{ next_url(post.path, post.title | default(__('post.untitled')), {class: 'post-title-link', itemprop: 'url' }) }} {% else -%} {{- post.title -}} {% include '../_partials/post-edit.swig' %} {% 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 }} {% if theme.read_more_btn %}
{{ __('post.read_more') }} »
{% endif %} {% elif post.excerpt %} {{ post.excerpt }} {% if theme.read_more_btn %}
{{ __('post.read_more') }} »
{% endif %} {% elif theme.auto_excerpt.enable %} {% set content = post.content | replace('.*?', "", "g") | striptags %}

{{ content.substring(0, theme.auto_excerpt.length) }} {% if content.length > theme.auto_excerpt.length %}...{% endif %}

{% if theme.read_more_btn %}
{{ __('post.read_more') }} »
{% endif %} {% else %} {% if post.type === 'picture' %} {{ post.content }} {% else %} {{ post.content }} {% endif %} {% endif %} {% else %} {{ post.content }} {% endif %}
{% if theme.related_posts.enable and (theme.related_posts.display_in_home or not is_index) %} {% include '../_partials/post/post-related.swig' with { post: post } %} {% endif %} {#####################} {### END POST BODY ###} {#####################} {% if theme.wechat_subscriber.enable and not is_index %} {% include '../_partials/post/wechat-subscriber.swig' %} {% endif %} {% if page.reward === undefined and theme.reward_settings.enable %} {% set reward_able = true %} {% else %} {% set reward_able = page.reward %} {% endif %} {% if reward_able and not is_index %}
{% include '../_partials/post/reward.swig' %}
{% endif %} {% if theme.creative_commons.license and theme.creative_commons.post and not is_index %}
{% include '../_partials/post/post-copyright.swig' with { post: post } %}
{% endif %} {######################} {### END POST BLOCK ###} {######################}
{% endmacro %}