這是一個hexo多語言切換套裝
因為hexo本身做多語言切換也是需要自己寫一些代碼的,利用這個套裝插件毯炮,可以節(jié)省不少的力氣
https://github.com/zyzyz/hexo-generator-basic-set/blob/master/index.js
/* global hexo */
'use strict'
var assign = require('object-assign');// 調用公共庫object-assign,合并對象用的
var per_page = typeof hexo.config.per_page === 'undefined' ? 10 : hexo.config.per_page;
/* Index */
if (hexo.config.index_generator) {
hexo.config.index_generator = assign({
per_page: per_page,
order_by: '-date'
}, hexo.config.index_generator);
hexo.extend.generator.register('index', require('./lib/generator-index'));
}
if (hexo.config.archive_generator) {
hexo.config.archive_generator = assign({
per_page: per_page,
yearly: true,
monthly: true,
daily: false
}, hexo.config.archive_generator);
hexo.extend.generator.register('archive', require('./lib/generator-archive'));
}
if (hexo.config.category_generator) {
hexo.config.category_generator = assign({
per_page: per_page,
}, hexo.config.category_generator);
hexo.extend.generator.register('category', require('./lib/generator-category'));
}
if (hexo.config.tag_generator) {
hexo.config.tag_generator = assign({
per_page: per_page,
enable_index_page: false
}, hexo.config.tag_generator);
hexo.extend.generator.register('tag', require('./lib/generator-tag'));
}
index文件是插件的入口文件
里面調用的其實就是 hexo.extend.generator.register,這個會在每次hexo g命令的時候調用