initial
This commit is contained in:
26
themes/next/scripts/helpers/engine.js
Normal file
26
themes/next/scripts/helpers/engine.js
Normal file
@ -0,0 +1,26 @@
|
||||
/* global hexo */
|
||||
|
||||
'use strict';
|
||||
|
||||
hexo.extend.helper.register('hexo_env', function(type) {
|
||||
return this.env[type];
|
||||
});
|
||||
|
||||
hexo.extend.helper.register('next_env', function(type) {
|
||||
var path = require('path');
|
||||
var env = require(path.normalize('../../package.json'));
|
||||
return env[type];
|
||||
});
|
||||
|
||||
hexo.extend.helper.register('item_active', function(path, className) {
|
||||
var canonical = this.page.canonical_path;
|
||||
var current = this.url_for(canonical).replace('index.html', '', 'g');
|
||||
var result = '';
|
||||
|
||||
if (current.indexOf(path) !== -1) {
|
||||
if (path !== '/' || path === current) {
|
||||
result = ' ' + className;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
Reference in New Issue
Block a user