Improve draft filtering
This commit is contained in:
parent
6dbe6567dd
commit
db0860ae2e
|
@ -49,7 +49,7 @@ module.exports = function (eleventyConfig) {
|
||||||
collection.sort((a, b) => a.data.sectionOrder - b.data.sectionOrder)
|
collection.sort((a, b) => a.data.sectionOrder - b.data.sectionOrder)
|
||||||
);
|
);
|
||||||
eleventyConfig.addFilter("filterDrafts", collection => {
|
eleventyConfig.addFilter("filterDrafts", collection => {
|
||||||
if (process.env.BUILD_DRAFTS) {
|
if (process.env.BUILD_DRAFTS == true || process.env.BUILD_DRAFTS == null) {
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,5 @@ eleventyNavigation:
|
||||||
order: 1
|
order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
{% set postsList = collections.posts | IsNotPage(page.url) %}
|
{% set postsList = collections.posts | filterDrafts | IsNotPage(page.url) %}
|
||||||
{% include "posts-list.njk" %}
|
{% include "posts-list.njk" %}
|
||||||
|
|
Loading…
Reference in a new issue