grav/themes/project-space/templates/partials/article.html.twig

51 lines
2.5 KiB
Twig
Raw Normal View History

{% set long_date = config.system.pages.dateformat.long %}
<article class="post {% if post.header.color %}{{ post.header.color }}{% endif %}" itemscope itemtype="http://schema.org/BlogPosting" role="article">
{% if post.header.image %}
<figure class="post-image" itemprop="image">
<a href="{{ post.url }}" class="js-ajax-link">
<img src="{{ post.media[post.header.image].cropResize(350, 350).url }}" width="100%" height="100%" alt="">
</a>
</figure>
{% endif %}
<header class="post-header">
<h3 class="post-title" itemprop="name">
<a href="{{ post.url }}" itemprop="url">{{ post.title }}</a>
</h3>
</header>
<section class="post-excerpt" itemprop="description">
{% if truncate is defined and truncate is not sameas(true) %}
<p>{{ post.content|raw|truncate_words(truncate) }}</p>
{% elseif truncate is defined and truncate >= 1 %}
<p>{{ post.content|raw|truncate_words(20) }}</p>
{% else %}
<p>{{ post.content|raw }}</p>
{% endif %}
</section>
<footer class="post-meta">
<span class="post-category">
<b>
{% if system.home.alias == '/' ~ page.slug %}
<a href="{{ '/' ~ page.slug }}/category{{ config.system.param_sep }}{{ post.taxonomy.category[0] }}">{{ post.taxonomy.category[0] }}</a>
{% else %}
<a href="{{ page.route }}/category{{ config.system.param_sep }}{{ post.taxonomy.category[0] }}">{{ post.taxonomy.category[0] }}</a>
{% endif %}
</b>
</span>
{% if post.taxonomy.tag|length > 0 %}
{% for tag in post.taxonomy.tag[0:3] %}
{% spaceless %}
<span class="post-tag">
{% if system.home.alias == '/' ~ page.slug %}
<a href="{{ '/' ~ page.slug }}/tag{{ config.system.param_sep }}{{ tag }}">{{ tag }}</a>
{% else %}
<a href="{{ page.route }}/tag{{ config.system.param_sep }}{{ tag }}">{{ tag }}</a>
{% endif %}
</span>{%if not loop.last %}, {% endif %}
{% endspaceless %}
{% endfor %}
{% endif %}
<time class="post-date" datetime="{{ post.modified | date(long_date) }}" title="Created: {{ post.date | date(long_date) }}, edited: {{ post.modified | date(long_date) }}">{{ post.date|date(long_date) }}</time>
</footer>
</article>