From 69008ce7fb6fdf798dade0e42f7cf76abfaf64e1 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 20 Jan 2020 13:52:21 -0500 Subject: [PATCH] Filter out trashed and draft posts --- src/parser.js | 1 + src/writer.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser.js b/src/parser.js index 3f5ac71..56504fb 100644 --- a/src/parser.js +++ b/src/parser.js @@ -37,6 +37,7 @@ function collectPosts(data, config) { const turndownService = translator.initTurndownService(); const posts = getItemsOfType(data, 'post') + .filter(post => post.status[0] !== 'trash' && post.status[0] !== 'draft') .map(post => ({ // meta data isn't written to file, but is used to help with other things meta: { diff --git a/src/writer.js b/src/writer.js index 3e77f60..3e875f3 100644 --- a/src/writer.js +++ b/src/writer.js @@ -57,7 +57,7 @@ async function loadMarkdownFilePromise(post) { let output = '---\n'; Object.entries(post.frontmatter).forEach(pair => { const key = pair[0]; - const value = pair[1].replace(/"/g, '\\"'); + const value = (pair[1] || '').replace(/"/g, '\\"'); output += key + ': "' + value + '"\n'; }); output += '---\n\n' + post.content + '\n';