date modification et tri
Some checks failed
Build and Deploy / build (push) Has been cancelled
Build and Deploy / deploy (push) Has been cancelled

This commit is contained in:
yann 2025-06-07 15:51:11 +02:00
parent d1e981b305
commit 43c6ce4b4e
4 changed files with 37 additions and 5 deletions

View File

@ -10,6 +10,8 @@
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1"> <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
{categories} {categories}
{tags} {tags}
{date}
{datemodif}
</div> </div>
</header> </header>
<p>{snippet}</p> <p>{snippet}</p>
@ -40,9 +42,24 @@
if (value === '') { if (value === '') {
return `${value}`; return `${value}`;
} else { } else {
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`; return `<div class="me-sm-4"><i class="fa fa-tag fa-fw"></i>${value}</div>`;
} }
} }
if (prop === 'date') {
if (value === '') {
return `${value}`;
} else {
return `<div class="me-sm-4"><i class="far fa-calendar fa-fw"></i>${value}</div>`;
}
}
if (prop === 'datemodif') {
if (value === '') {
return `${value}`;
} else {
return `<div class="me-sm-4" style='color:red'><i class="far fa-calendar fa-fw" style='color:red'></i>${value}</div>`;
}
}
} }
}); });
}); });

View File

@ -17,7 +17,11 @@ layout: page
<li class="d-flex justify-content-between px-md-3"> <li class="d-flex justify-content-between px-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <span class="dash flex-grow-1"></span>
{% if post.last_modified_at %}
{% include datetime.html date=post.last_modified_at class='text-muted small text-nowrap' lang=lang %}&nbsp;
{% endif %}
{% include datetime.html date=post.date class='text-muted small text-nowrap' lang=lang %} {% include datetime.html date=post.date class='text-muted small text-nowrap' lang=lang %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -88,6 +88,11 @@ refactor: true
<i class="far fa-calendar fa-fw me-1"></i> <i class="far fa-calendar fa-fw me-1"></i>
{% include datetime.html date=post.date lang=lang %} {% include datetime.html date=post.date lang=lang %}
{% if post.last_modified_at %}
<i class="far fa-calendar fa-fw me-1" style='color:red'></i>
{% include datetime.html date=post.last_modified_at lang=lang %}
{% endif %}
<!-- categories --> <!-- categories -->
{% if post.categories.size > 0 %} {% if post.categories.size > 0 %}
<i class="far fa-folder-open fa-fw me-1"></i> <i class="far fa-folder-open fa-fw me-1"></i>

View File

@ -4,13 +4,19 @@ swcache: true
--- ---
[ [
{% for post in site.posts %} {% assign posts = site.posts | sort: 'last_modified_at' | reverse %}
{% for post in posts %}
{ {
"title": {{ post.title | jsonify }}, "title": {{ post.title | jsonify }},
"url": {{ post.url | relative_url | jsonify }}, "url": {{ post.url | relative_url | jsonify }},
"categories": {{ post.categories | join: ', ' | jsonify }}, "categories": {{ post.categories | join: ', ' | jsonify }},
"tags": {{ post.tags | join: ', ' | jsonify }}, "tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}", "date": "{{ post.date | date: '%d/%m/%Y' }}",
{% if post.last_modified_at %}
"datemodif": "{{ post.last_modified_at | date: '%d/%m/%Y' }}",
{% else %}
"datemodif": "",
{% endif %}
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
{% assign _content = content | strip_html | strip_newlines %} {% assign _content = content | strip_html | strip_newlines %}
"snippet": {{ _content | truncate: 200 | jsonify }} "snippet": {{ _content | truncate: 200 | jsonify }}