added possibility to unpublish pages

This commit is contained in:
suroh 2023-09-03 21:43:03 +02:00
parent 1d45dc8ffa
commit 7d0ec7dd4c
6 changed files with 17 additions and 5 deletions

View File

@ -26,7 +26,7 @@ module.exports = (config) => {
config.addCollection('pages', (collection) => { config.addCollection('pages', (collection) => {
let sorted = [] let sorted = []
let unsorted = [] let unsorted = []
const pages = collection.getFilteredByGlob('**/*.md') let pages = collection.getFilteredByGlob('**/*.md')
for (let page of pages) { for (let page of pages) {
if (page.data.sort) { if (page.data.sort) {
@ -40,6 +40,8 @@ module.exports = (config) => {
} }
} }
sorted = sorted.filter(p => p.data.published)
return sorted.concat(unsorted) return sorted.concat(unsorted)
}) })

View File

@ -1 +1,4 @@
{ "category": "audio" } {
"category": "audio",
"published": true
}

View File

@ -1 +1,4 @@
{ "category": "other" } {
"category": "other",
"published": true
}

View File

@ -2,6 +2,7 @@
title: stone throw title: stone throw
layout: page.njk layout: page.njk
imgFeat: /work/images/stoneThrow/scanPage.png imgFeat: /work/images/stoneThrow/scanPage.png
published: false
sort: 1 sort: 1
--- ---

View File

@ -1 +1,4 @@
{ "category": "work" } {
"category": "work",
"published": true
}

View File

@ -2,7 +2,6 @@
"name": "work.suroh.tk", "name": "work.suroh.tk",
"version": "1.1.0", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js",
"dependencies": { "dependencies": {
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"markdown-it-link-attributes": "^4.0.1" "markdown-it-link-attributes": "^4.0.1"
@ -11,6 +10,7 @@
"@11ty/eleventy": "^0.9.0" "@11ty/eleventy": "^0.9.0"
}, },
"scripts": { "scripts": {
"dev": "eleventy --serve",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": { "repository": {