blog/themes/next/layout/_macro/post.njk

159 lines
6.0 KiB
Plaintext

{##################}
{### POST BLOCK ###}
{##################}
<div class="post-block">
{# Gallery support #}
{{ post_gallery(post.photos) }}
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="{{ post.lang }}">
<link itemprop="mainEntityOfPage" href="{{ post.permalink }}">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="{{ url_for(theme.avatar.url or theme.images + '/avatar.gif') }}">
<meta itemprop="name" content="{{ author }}">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="{{ title }}">
<meta itemprop="description" content="{{ description }}">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="{{ escape_html(page.title or '') + ' | ' + title }}">
<meta itemprop="description" content="{{ escape_html(page.description or '') }}">
</span>
{%- if post.header !== false %}
<header class="post-header">
<{% if is_index %}h2{% else %}h1{% endif %} class="post-title{% if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{% endif %}" itemprop="name headline">
{# Link posts #}
{%- if post.link %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumbtack"></i>
</span>
{%- endif %}
{%- set postTitleIcon = '<i class="fa fa-external-link-alt"></i>' %}
{%- set postText = post.title or post.link %}
{{- next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url'}) }}
{% elif is_index %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumbtack"></i>
</span>
{%- endif %}
{{- next_url(post.path, post.title or __('post.untitled'), {class: 'post-title-link', itemprop: 'url'}) }}
{%- else %}
{{- post.title }}
{{- post_edit(post.source) }}
{%- endif %}
</{% if is_index %}h2{% else %}h1{% endif %}>
<div class="post-meta-container">
{{ partial('_partials/post/post-meta.njk') }}
{%- if post.description and (not theme.excerpt_description or not is_index) %}
<div class="post-description">{{ post.description }}</div>
{%- endif %}
</div>
</header>
{%- endif %}
{#################}
{### POST BODY ###}
{#################}
<div class="post-body{% if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{% endif %}" itemprop="articleBody">
{%- if is_index %}
{%- if post.description and theme.excerpt_description %}
<p>{{ post.description }}</p>
<!--noindex-->
{%- if theme.read_more_btn %}
<div class="post-button">
<a class="btn" href="{{ url_for(post.path) }}">
{{ __('post.read_more') }} &raquo;
</a>
</div>
{%- endif %}
<!--/noindex-->
{% elif post.excerpt %}
{{ post.excerpt }}
<!--noindex-->
{%- if theme.read_more_btn %}
<div class="post-button">
<a class="btn" href="{{ url_for(post.path) }}#more" rel="contents">
{{ __('post.read_more') }} &raquo;
</a>
</div>
{%- endif %}
<!--/noindex-->
{% else %}
{{ post.content }}
{%- endif %}
{% else %}
{{- next_inject('postBodyStart') }}
{{- post.content }}
{%- endif %}
</div>
{#####################}
{### END POST BODY ###}
{#####################}
<footer class="post-footer">
{%- if is_index %}
<div class="post-eof"></div>
{% else %}
{{- next_inject('postBodyEnd') }}
{%- if post.reward_settings.enable %}
{{ partial('_partials/post/post-reward.njk') }}
{%- endif %}
{%- if theme.creative_commons.license and theme.creative_commons.post and post.copyright !== false %}
{{ partial('_partials/post/post-copyright.njk') }}
{%- endif %}
{%- if theme.follow_me %}
{{ partial('_partials/post/post-followme.njk', {}, {cache: theme.cache.enable}) }}
{%- endif %}
{%- if post.tags and post.tags.length %}
{%- set tag_indicate = '<i class="fa fa-tag"></i>' if theme.tag_icon else '#' %}
<div class="post-tags">
{%- for tag in post.tags.toArray() %}
<a href="{{ url_for(tag.path) }}" rel="tag">{{ tag_indicate }} {{ tag.name }}</a>
{%- endfor %}
</div>
{%- endif %}
{{ partial('_partials/post/post-share.njk', {}, {cache: theme.cache.enable}) }}
{%- if theme.post_navigation and (post.prev or post.next) %}
{%- set prev = post.prev if theme.post_navigation === 'right' else post.next %}
{%- set next = post.next if theme.post_navigation === 'right' else post.prev %}
<div class="post-nav">
<div class="post-nav-item">
{%- if prev %}
<a href="{{ url_for(prev.path) }}" rel="prev" title="{{ escape_html(prev.title or '') }}">
<i class="fa fa-angle-left"></i> {{ prev.title }}
</a>
{%- endif %}
</div>
<div class="post-nav-item">
{%- if next %}
<a href="{{ url_for(next.path) }}" rel="next" title="{{ escape_html(next.title or '') }}">
{{ next.title }} <i class="fa fa-angle-right"></i>
</a>
{%- endif %}
</div>
</div>
{%- endif %}
{%- endif %}
</footer>
</article>
</div>
{######################}
{### END POST BLOCK ###}
{######################}