blog/themes/cmd/layout/includes/postlist.njk
thisLight 781759d545 move cmd to nunjucks & update hexo to 6.0.0
Other changes:
* minor fix to the display for code blocks
* remove floating when hover on cards
* replace the list of tags and categories to the index page one
* small change on the title of tags' and categories' pages
2021-12-31 18:07:40 +08:00

44 lines
1.5 KiB
Text

{%from 'includes/tags.njk' import PostTags with context%}
{% macro PostList(posts) %}
<ul class="collection">
{% for post in posts %}
<li class="collection-item no-padding">
<div class="card z-depth-0 card-small-margin">
{% if post.photos and post.photos.length > 0 %}
<a href="{{ url_for(post.path) }}">
<div class="card-image">
<img class="responsive-img" src="{{ post.photos[0] }}"/>
<span class="card-title">{{ post.title }}</span>
</div>
</a>
{% if (post.tags.length > 0) or post.excerpt != "" %}
<div class="card-content">
{{ PostTags(post) }}
{% if post.excerpt != "" %}
<p class="entry">{{ post.excerpt }}</p>
{% endif %}
</div>
{% endif %}
{% else %}
<div class="card-content">
<a href="{{ post.link if post.link else url_for(post.path) }}" {% if post.link %} target="_blank" {% endif %}>
<span class="card-title">
{% if (post.title != '' and post.title !== null and post.title !== undefined) %}
{{ post.title }}
{% else %}
{{ post.path }}
{% endif %}
</span>
</a>
<p class="entry">{{ post.excerpt }}</p>
{{ PostTags(post) }}
</div>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% endmacro %}