diff --git a/src/frontmatter/excerpt.js b/src/frontmatter/excerpt.js new file mode 100644 index 0000000..5c1e1f0 --- /dev/null +++ b/src/frontmatter/excerpt.js @@ -0,0 +1,5 @@ +// get excerpt, not decoded, newlines collapsed +module.exports = (post) => { + const excerpt = post.data.encoded[1].replace(/[(\r\n|\n|\r)]/gm, " "); + return excerpt; +}; diff --git a/src/parser.js b/src/parser.js index 0a82f3e..e1dafa9 100644 --- a/src/parser.js +++ b/src/parser.js @@ -110,11 +110,6 @@ function getPostCoverImageId(postData) { return id; } -function getPostExcerpt(post) { - const excerpt = post.encoded[1].replace(/(\r\n|\n|\r)/gm, " "); - return excerpt; -} - function collectAttachedImages(channelData) { const images = getItemsOfType(channelData, 'attachment') // filter to certain image file types