How to use the hexo/lib/models/post.paths function in hexo

To help you get started, we’ve selected a few hexo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ppoffice / hexo-theme-icarus / include / filter / locals.js View on Github external
module.exports = hexo => {
    const RESERVED_KEYS = {
        post: Object.keys(require('hexo/lib/models/post')(hexo).paths),
        page: Object.keys(require('hexo/lib/models/page')(hexo).paths)
    };

    function getThemeConfig(extension) {
        if (fs.existsSync(path.join(hexo.theme_dir, '_config' + extension + '.yml'))) {
            return yaml.safeLoad(fs.readFileSync(path.join(hexo.theme_dir, '_config' + extension + '.yml')));
        }
        return null;
    }

    const ALTERNATIVE_CONFIG = {
        post: getThemeConfig('.post'),
        page: getThemeConfig('.page')
    }

    function getExtraConfig(source, reservedKeys) {