feat: page history - download version

This commit is contained in:
NGPixel
2020-02-24 21:10:43 -05:00
committed by Nicolas Giard
parent 95f01cdeb8
commit 2ac9131244
4 changed files with 89 additions and 27 deletions

View File

@@ -73,11 +73,14 @@ module.exports = {
['date', page.updatedAt],
['tags', page.tags ? page.tags.map(t => t.tag).join(', ') : '']
]
const inject = {
'markdown': '---\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n---\n\n' + page.content,
'html': '<!--\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n-->\n\n' + page.content
switch (page.contentType) {
case 'markdown':
return '---\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n---\n\n' + page.content
case 'html':
return '<!--\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n-->\n\n' + page.content
default:
return page.content
}
return _.get(inject, page.contentType, page.content)
},
/**
* Check if path is a reserved path