Traitement des articles anciens sur le blog.
This commit is contained in:
@@ -95,6 +95,21 @@ abbr {
|
||||
border-bottom: 1px dotted #373d3f;
|
||||
}
|
||||
|
||||
.archives {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.archives article {
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
width: calc(50% - 2em);
|
||||
}
|
||||
|
||||
.archives article h2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.loader-wrapper {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 4fr;
|
||||
|
||||
@@ -3,12 +3,21 @@
|
||||
{% block article %}
|
||||
<h1 class="mt128">Actualités</h1>
|
||||
{% block header %}{{ header | safe }}{% endblock %}
|
||||
{% for article in collections["year"] %}
|
||||
<article>
|
||||
{% for article in collections["archives"] %}
|
||||
<h2><a href="/{{ article.path }}">{{ date_format(article.date) }} | {{ article.title }}</a></h2>
|
||||
{{ article.excerpt | safe }}
|
||||
<p><a href="/{{ article.path }}">Lire la suite...</a></p>
|
||||
</article>
|
||||
{% else %}
|
||||
{% endfor %}
|
||||
<div class="archives mt64">
|
||||
{% for article in collections["archives"] %}
|
||||
<article>
|
||||
<h2><a href="/{{ article.path }}">{{ date_format(article.date) }} | {{ article.title }}</a></h2>
|
||||
{{ article.excerpt | safe }}
|
||||
</article>
|
||||
{% else %}
|
||||
{% endfor %}
|
||||
</article>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -95,6 +95,17 @@ module.exports = new Metalsmith(config.paths.projectRoot)
|
||||
archives: {
|
||||
pattern: 'blog/*/**/*/*.html',
|
||||
reverse: true,
|
||||
filterBy: (article) => {
|
||||
return new Date(article.date).getFullYear() !== new Date().getFullYear()
|
||||
},
|
||||
sortBy: 'date'
|
||||
},
|
||||
year: {
|
||||
pattern: 'blog/*/**/*/*.html',
|
||||
reverse: true,
|
||||
filterBy: (article) => {
|
||||
return new Date(article.date).getFullYear() === new Date().getFullYear()
|
||||
},
|
||||
sortBy: 'date'
|
||||
},
|
||||
news: {
|
||||
|
||||
Reference in New Issue
Block a user