docs: create a partial tag helper to include shared markdown files

This commit is contained in:
Brian Mann
2017-06-13 11:12:30 -04:00
parent 4f6734c2e4
commit a433b1eaa7
3 changed files with 16 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
'use strict'
const path = require('path')
const util = require('hexo-util')
const urlGenerator = require('../lib/url_generator')
@@ -107,3 +108,9 @@ hexo.extend.tag.register('url', function (args) {
})
}, { async: true })
hexo.extend.tag.register('partial', (fileName) => {
const pathToFile = path.resolve('source', '_partial', `${fileName}.md`)
return hexo.render.render({ path: pathToFile, engine: 'markdown' })
}, { async: true })