feat: add page to see article in draft

pull/13/head
Nicolas Doby 2023-03-16 14:27:30 +01:00
parent 0f554341e5
commit 81bcf5013a
2 changed files with 21 additions and 0 deletions

View File

@ -85,6 +85,10 @@ module.exports = function(eleventyConfig) {
return articles.filter(article => !article.data.draft); return articles.filter(article => !article.data.draft);
}); });
eleventyConfig.addFilter("onlyDraft", articles => {
return articles.filter(article => article.data.draft);
});
// Return all the tags used in a collection // Return all the tags used in a collection
eleventyConfig.addFilter("getAllTags", collection => { eleventyConfig.addFilter("getAllTags", collection => {
let tags = new Map(); let tags = new Map();

17
src/_pages/blog/draft.njk Normal file
View File

@ -0,0 +1,17 @@
---
layout: home.njk
---
<div class="main-content">
<h1>Articles en construction</h1>
{% set articlesList = collections.articles | onlyDraft %}
{% if articlesList.len > 0 %}
{% include "articlesList.njk" %}
{% else %}
<p>Tous les articles sont en ligne ! Retournez à <a href="/blog/">l'accueil</a> pour les consulter.</p>
{% endif %}
</div>
<aside class="right-side">
{% include "tagslist.njk" %}
{% include "other_links.njk" %}
</aside>