12345678910111213141516171819202122 |
- hexo.extend.helper.register('order_pages', function(pages){
- var page_list = [];
- pages.forEach(page => {
- page_list.push(page);
- });
- page_list.sort(function(a,b){
- return new Date(b.date) - new Date(a.date);
- });
- return page_list;
- });
- hexo.extend.helper.register('get_page', function(pages, id){
- var result = undefined;
- pages.forEach(page => {
- if(page.id != undefined){
- if(page.id == id) {
- result = page;
- }
- }
- });
- return result;
- });
|