Commit f7733a6d authored by jimakker's avatar jimakker

custom scripts!

parent 18e60851
var hexo = hexo || {};
function columns(args, content){
var messageClass = args[1] || '';
content = hexo.render.renderSync({text: content, engine: 'markdown'});
var text = '<div class="columns">' + content + '</div>';
return text;
}
hexo.extend.tag.register('columns', columns, {ends: true});
function column(args, content){
var size = args[0] || '';
content = hexo.render.renderSync({text: content, engine: 'markdown'});
var text = '<div class="column ' + size + '">' + content + '</div>';
return text;
}
hexo.extend.tag.register('column', column, {ends: true});
var hexo = hexo || {};
function icon(args){
var iconClass = args[0] || '';
var iconSize = args[1] || '';
var text = '<span class="icon '+ iconSize +'">' +
'<i class="fa fa-'+ iconClass +'"></i>' +
'</span>';
return text;
}
hexo.extend.tag.register('icon', icon);
var hexo = hexo || {};
function message(args, content){
var messageClass = args[1] || '';
content = hexo.render.renderSync({text: content, engine: 'markdown'});
var text = '<div class="message '+ messageClass +'">' +
'<div class="message-header">' + args[0] + '</div>' +
'<div class="message-body">' + content + '</div></div>';
return text;
}
hexo.extend.tag.register('message', message, {ends: true});
var hexo = hexo || {};
function notification(args, content){
var text = '<div class="notification">' + content + '</div>';
text = hexo.render.renderSync({text: text, engine: 'markdown'});
return text;
}
hexo.extend.tag.register('notification', notification, {ends: true});
var hexo = hexo || {};
var pagination = require('hexo-pagination');
function bpaginator(){
var current = this.page.current;
var total = this.page.total;
var base = this.page.base;
var dir = this.config.pagination_dir;
var result= '';
var previous = '<a href="/'+ (base? base:'') + (current-1 === 1 ? '':(dir+'/'+(current-1)) ) + '">Previous</a>';
var next = '<a href="/'+ (base? base:'') + dir +'/'+ (current+1) + '">Next</a>';
if(current<total) result +=next;
if(current>1) result += previous;
result += '<ul></ul>';
return result;
}
hexo.extend.helper.register('bpaginator', bpaginator);
var hexo = hexo || {};
function renderPage(path){
var page = hexo.model('Page').findOne({ source: path });
return page.toObject().content;
}
hexo.extend.helper.register('renderPage', renderPage);
var hexo = hexo || {};
function title(args){
var size = args[1] || '';
var text = '<h1 class="title '+ size +'">' + args[0] + '</h1>';
return text;
}
hexo.extend.tag.register('title', title);
function subtitle(args){
var size = args[1] || '';
var text = '<h2 class="subtitle '+ size +'">' + args[0] + '</h2>';
return text;
}
hexo.extend.tag.register('subtitle', subtitle);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment