#333 - collection and published field support

This commit is contained in:
Elio Struyf
2022-05-13 08:18:42 +02:00
parent 4c97993c5f
commit e78069ad17
2 changed files with 36 additions and 6 deletions
+7
View File
@@ -33,8 +33,15 @@ export default function usePages(pages: Page[]) {
// Framework specific actions
if (framework?.toLowerCase() === "jekyll") {
pagesToShow = pagesToShow.map(page => {
// https://jekyllrb.com/docs/posts/#drafts
const filePath = parseWinPath(page.fmFilePath);
page.draft = filePath.indexOf(`/_drafts/`) > -1;
// Published field: https://jekyllrb.com/docs/front-matter/#predefined-global-variables
if (typeof page.published !== "undefined") {
page.draft = !page.published;
}
return page;
});
}