forked from ti-nuage/site
Traitement des articles anciens sur le blog.
This commit is contained in:
@@ -95,6 +95,21 @@ abbr {
|
|||||||
border-bottom: 1px dotted #373d3f;
|
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 {
|
.loader-wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 4fr;
|
grid-template-columns: 1fr 4fr;
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
{% block article %}
|
{% block article %}
|
||||||
<h1 class="mt128">Actualités</h1>
|
<h1 class="mt128">Actualités</h1>
|
||||||
{% block header %}{{ header | safe }}{% endblock %}
|
{% block header %}{{ header | safe }}{% endblock %}
|
||||||
|
{% for article in collections["year"] %}
|
||||||
<article>
|
<article>
|
||||||
{% for article in collections["archives"] %}
|
|
||||||
<h2><a href="/{{ article.path }}">{{ date_format(article.date) }} | {{ article.title }}</a></h2>
|
<h2><a href="/{{ article.path }}">{{ date_format(article.date) }} | {{ article.title }}</a></h2>
|
||||||
{{ article.excerpt | safe }}
|
{{ article.excerpt | safe }}
|
||||||
<p><a href="/{{ article.path }}">Lire la suite...</a></p>
|
<p><a href="/{{ article.path }}">Lire la suite...</a></p>
|
||||||
|
</article>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% endfor %}
|
{% 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>
|
</article>
|
||||||
|
{% else %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -95,6 +95,17 @@ module.exports = new Metalsmith(config.paths.projectRoot)
|
|||||||
archives: {
|
archives: {
|
||||||
pattern: 'blog/*/**/*/*.html',
|
pattern: 'blog/*/**/*/*.html',
|
||||||
reverse: true,
|
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'
|
sortBy: 'date'
|
||||||
},
|
},
|
||||||
news: {
|
news: {
|
||||||
|
|||||||
Reference in New Issue
Block a user