pages marked unpublished are not rendered. changing publish status to false removes rendered html page

pull/20/head
Ro 4 years ago
parent 33decbea9a
commit 5a9a14deaa

@ -31,12 +31,12 @@ export default class Render {
.then(config => {
let response = [];
let count = _.filter(pages, page => {
return page.metadata.deleted === false;
return page.metadata.deleted === false && page.metadata.published === true;
}).length;
let rendered = 0;
for (let index = 0; index < pages.length; index++) {
const page = pages[index];
if (page.metadata.deleted === false) {
if (page.metadata.deleted === false && page.metadata.published === true) {
let writeFile, template;
//create case for index path
let path =
@ -103,8 +103,27 @@ export default class Render {
resolve(response);
}
} else {
if (count === 0) {
response = {
type: DataEvent.PAGES_RENDERED,
message: 'No page rendering needed'
};
resolve(response);
}
//don't render delete pages
//check to see if deleted pages have been renderered and delete them
if (page.metadata.layout !== 'index') {
fs.unlink(
'public/' +
page.metadata.path +
'/' +
page.metadata.slug +
'.html'
).then(() => {
console.log('REMOVED');
});
}
console.log('REMOVE', page.metadata.slug);
}
}
})

Loading…
Cancel
Save