2025-2-26-fixed
This commit is contained in:
41
themes/next/layout/_macro/post-collapse.swig
Normal file
41
themes/next/layout/_macro/post-collapse.swig
Normal file
@ -0,0 +1,41 @@
|
||||
{% macro render(posts) %}
|
||||
{%- set current_year = '1970' %}
|
||||
{%- for post in posts.toArray() %}
|
||||
|
||||
{%- set year = date(post.date, 'YYYY') %}
|
||||
|
||||
{%- if year !== current_year %}
|
||||
{%- set current_year = year %}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ current_year }}</span>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
|
||||
<div class="post-meta">
|
||||
<time itemprop="dateCreated"
|
||||
datetime="{{ moment(post.date).format() }}"
|
||||
content="{{ date(post.date, config.date_format) }}">
|
||||
{{ date(post.date, 'MM-DD') }}
|
||||
</time>
|
||||
</div>
|
||||
|
||||
<div class="post-title">
|
||||
{%- if post.link %}{# Link posts #}
|
||||
{%- 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'}) }}
|
||||
{% else %}
|
||||
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
|
||||
<span itemprop="name">{{ post.title or __('post.untitled') }}</span>
|
||||
</a>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
</header>
|
||||
</article>
|
||||
|
||||
{%- endfor %}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user