mirror of
https://github.com/welpo/tabi.git
synced 2025-12-14 11:48:45 +01:00
The meta column of the blogposts list was fixed to 13.5rem. I can be annoying when displaying something else but a date as it was initially planned. Width set to 13.5rem has been kept when displaying a date to avoid any regression. Nevertheless, it is possible to get rid of it in the future if needed. Feed has been adapted accordingly.
82 lines
4.3 KiB
HTML
82 lines
4.3 KiB
HTML
{% macro list_posts(posts, max, language_strings="", section_path="blog") %}
|
|
|
|
{%- set separator = config.extra.separator | default(value="•") -%}
|
|
|
|
<div class="bloglist-container">
|
|
{% for post in posts %}
|
|
{% if loop.index <= max %}
|
|
{% if loop.index == max %}
|
|
{% set bottom_divider = false %}
|
|
{% elif loop.last %}
|
|
{% set bottom_divider = false %}
|
|
{% else %}
|
|
{% set bottom_divider = true %}
|
|
{% endif %}
|
|
|
|
<section class="bloglist-meta {% if bottom_divider -%}bottom-divider{%- endif -%}">
|
|
<ul>
|
|
{%- set allowed_post_listing_dates = ["date", "updated", "both"] -%}
|
|
{%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%}
|
|
{%- if post_listing_date not in allowed_post_listing_dates -%}
|
|
{{ throw(message="ERROR: Invalid value for config.extra.post_listing_date. Allowed values are 'date', 'updated', or 'both'.") }}
|
|
{%- endif -%}
|
|
|
|
{%- set show_date = post.date and post_listing_date == "date" or post.date and post_listing_date == "both" or post.date and post_listing_date == "updated" and not post.updated -%}
|
|
{%- set show_updated = post.updated and post_listing_date == "updated" or post.updated and post_listing_date == "both" -%}
|
|
|
|
{%- if show_date or show_updated -%}
|
|
{%- if show_date -%}
|
|
<li class="date">{{- macros_format_date::format_date(date=post.date, short=false, language_strings=language_strings) -}}</li>
|
|
{%- endif -%}
|
|
{%- if show_date and show_updated -%}
|
|
<li class="mobile-only">{{- separator -}}</li>
|
|
{%- endif -%}
|
|
{%- if show_updated -%}
|
|
{%- set last_updated_str = macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -%}
|
|
{%- set formatted_date = macros_format_date::format_date(date=post.updated, short=true, language_strings=language_strings) -%}
|
|
{%- set updated_str = last_updated_str | replace(from="$DATE", to=formatted_date) -%}
|
|
<li class="date">{{ updated_str }}</li>
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
|
|
{% if post.draft %}
|
|
<li class="draft-label">{{ macros_translate::translate(key="draft", default="DRAFT", language_strings=language_strings) }}</li>
|
|
{% endif %}
|
|
</ul>
|
|
</section>
|
|
<section class="bloglist-content {% if bottom_divider -%}bottom-divider{%- endif -%}">
|
|
<div>
|
|
<h2 class="bloglist-title">
|
|
<a href="{{ post.permalink }}">{{ post.title }}</a>
|
|
</h2>
|
|
|
|
{% if post.taxonomies.tags %}
|
|
<div class="bloglist-tags">
|
|
{% for tag in post.taxonomies.tags %}
|
|
<a class="tag" href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}">{{ tag }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="description">
|
|
{% if post.description %}
|
|
<p>{{ post.description }}</p>
|
|
{% elif post.summary %}
|
|
<p>{{ post.summary | striptags | trim_end_matches(pat=".") | safe }}…</p>
|
|
{% endif %}
|
|
</div>
|
|
<a class="readmore" href="{{ post.permalink }}">{{ macros_translate::translate(key="read_more", default="Read more", language_strings=language_strings) }} <span class="arrow">→</span></a>
|
|
</div>
|
|
</section>
|
|
{% endif %}
|
|
{% if not loop.last %}
|
|
{% if loop.index == max %}
|
|
<div class="all-posts">
|
|
<a href="{{ get_url(path=section_path, lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts", language_strings=language_strings) }} <span class="arrow">⟶</span></a>
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% endmacro %}
|