blog/themes/typing/scripts/feed/index.js

33 lines
644 B
JavaScript

/* global hexo */
'use strict'
/*
* Modified from the hexo version,
* https://github.com/hexojs/hexo-generator-feed
* to use post.lastUpdated and remove timezone
*/
const pathFn = require('path')
const config = hexo.config.feed = Object.assign({
type: 'atom',
limit: 20,
hub: '',
content: true,
content_limit: 140,
content_limit_delim: '',
order_by: '-date'
}, hexo.config.feed)
// Set default feed path
if (!config.path) {
config.path = config.type + '.xml'
}
// Add extension name if don't have
if (!pathFn.extname(config.path)) {
config.path += '.xml'
}
hexo.extend.generator.register('feed', require('./generator'))