Skip to content

Commit

Permalink
Support custom date format in item list
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Apr 24, 2024
1 parent 965926e commit 1effd80
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions _includes/item_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
{%- assign show_image=false -%}
{%- endif -%}

{%- assign date_format = include.date_format | default: site.date_format | default: "%b %e, %Y" -%}

<div class="item-list {{collection}}-list {{category}}-list {% if include.gallery %}gallery{% endif %} {% if include.scroll %}scroll{% endif %} {% if include.titles=='' %}no-titles{% endif %}">
{%- for item in _items -%}
{%- assign names=item.author | default: item.speaker -%}
Expand All @@ -30,7 +32,7 @@
<div class="{{include.type}}-item-listing">
<p>
<a class="title" href="{{item.url | absolute_url}}">{{title}} {% if item.youtube or item.podbean or item.video_src %}<svg class="iconsvg"><use xlink:href="#play-circle"></use></svg>{% endif %}</a>
<span><span class='date cond-only'>{{item.date | date: site.date_format }}</span>
<span><span class='date cond-only'>{{item.date | date: date_format }}</span>
{%-if names and names.size > 0 %}
<span class="cond-only">&middot;</span><span class="no-cond">|</span>
{% if include.ignore_name %}
Expand All @@ -39,7 +41,7 @@
{%- include names_list.html names=names avatar=false -%}
{%- endif -%}</span>
</p>
<p><span class='date no-cond'>{{item.date | date: site.date_format }}</span></p>
<p><span class='date no-cond'>{{item.date | date: date_format }}</span></p>
</div>
{% else %}
<div class="item-listing {% if include.contain_image %}contained-image{% endif %}">
Expand Down Expand Up @@ -81,10 +83,10 @@ <h3><a href="{{item.url | absolute_url}}">{{title}}</a></h3>
{%- endif -%}
{%- if include.subtitles -%}
<p class="meta subtitle">{{include.subtitles | slice: forloop.index0 }}</p>
{%- elsif item.collection=='posts' -%}
{%- elsif item.collection=='posts' or include.date_format -%}
{%- unless include.gallery -%}
<p class="meta">
<span class='date'>{{item.date | date: site.date_format }}</span>
<span class='date'>{{item.date | date: date_format }}</span>
{% if names %}
&middot;
{% include names_list.html names=names %}
Expand Down

0 comments on commit 1effd80

Please sign in to comment.