feat: Change article list on homepage to be simply date and title

This commit is contained in:
Alexis Fourmaux 2025-12-23 21:24:00 +01:00
parent 776defa40d
commit bb4dc4b1a5
4 changed files with 53 additions and 2 deletions

View file

@ -0,0 +1,37 @@
ul.articles-index {
list-style-type: none;
padding-left: 0;
li {
margin-top: 1rem;
margin-bottom: 1rem;
}
.title {
margin: 0;
&>a {
color: var(--text);
text-decoration: none;
font-weight: bold;
&:visited {
color: var(--lavender);
}
&:hover {
color: var(--sky);
}
}
&::before {
content: "-";
margin-left: .5rem;
margin-right: .5rem;
}
}
.date {
color: var(--subtext0);
}
}

View file

@ -2,6 +2,7 @@
@use 'theme'; @use 'theme';
@use 'shortcodes/callout'; @use 'shortcodes/callout';
@use 'parts/anchor'; @use 'parts/anchor';
@use 'parts/articles-index';
@use 'parts/articles'; @use 'parts/articles';
@use 'parts/index'; @use 'parts/index';
@use 'parts/code'; @use 'parts/code';

View file

@ -7,7 +7,6 @@
<section class="last-articles"> <section class="last-articles">
<h1>Derniers articles</h1> <h1>Derniers articles</h1>
{%- set section = get_section(path="articles/_index.md") -%} {%- set section = get_section(path="articles/_index.md") -%}
{%- set max_articles = 3 -%} {%- include "partials/articles-index.html" -%}
{%- include "partials/articles.html" -%}
</section> </section>
{% endblock content %} {% endblock content %}

View file

@ -0,0 +1,14 @@
<ul class="articles-index">
{% for page in section.pages %}
{%- if max_articles is defined and loop.index > max_articles -%}{%- break -%}{%- endif -%}
<li>
<span class="date">
<meta itemprop="datePublished" content="{{ page.date | date(format='%+') }}">
{{ page.date | date(format='%Y-%m-%d') }}
</span>
<span class="title">
<a href="{{ page.permalink }}">{{ page.title }}</a>
</span>
</li>
{% endfor %}
</ul>