forked from hexojs/hexo-generator-feed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (32 loc) · 885 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* global hexo */
'use strict';
var assign = require('object-assign');
var pathFn = require('path');
var config = hexo.config.feed = assign({
type: 'atom',
limit: 20,
hub: '',
content: true
}, hexo.config.feed);
var type = config.type.toLowerCase();
// Check feed type
if (type !== 'atom' && type !== 'rss2') {
config.type = 'atom';
} else {
config.type = type;
}
// Set default feed path
if (!config.path) {
config.path = config.type + '.xml';
}
// Set itunes feed path
if (!config.itunespath) {
config.itunespath = 'itunes.xml'
}
// Add extension name if don't have
if (!pathFn.extname(config.path)) {
config.path += '.xml';
}
hexo.extend.generator.register('feed', require('./lib/generator'));
hexo.extend.generator.register('authorfeed', require('./lib/generator-author'));
hexo.extend.generator.register('itunesfeed', require('./lib/itunesgenerator'));