Make tags and categories arrays

This commit is contained in:
Stan Lemon
2020-06-28 11:21:04 -04:00
parent b7aef9302b
commit 0487bd7e0c
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -58,8 +58,10 @@ async function loadMarkdownFilePromise(post) {
let output = '---\n';
Object.entries(post.frontmatter).forEach(pair => {
const key = pair[0];
const value = (pair[1] || '').replace(/"/g, '\\"');
output += key + ': "' + value + '"\n';
const value = Array.isArray(pair[1])
? (pair[1].length === 0 ? "" : "\n - \"" + pair[1].join("\"\n - \"") + "\"")
: '"' + (pair[1] || '').replace(/"/g, '\\"') +'"';
output += key + ': ' + value + '\n';
});
output += '---\n\n' + post.content + '\n';
return output;