We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index_generator: path: '' per_page: 10 order_by: -date exclude: true //set true if you wanna exclude exclude_list: - novel //set categories name you wanna exclude - gossip //set categories name you wanna exclude
'use strict'; const pagination = require('hexo-pagination'); const { sort } = require('timsort'); module.exports = function(locals) { const config = this.config; const posts = locals.posts.sort(config.index_generator.order_by); const temp_posts = []; sort(posts.data, (a, b) => (b.sticky || 0) - (a.sticky || 0)); const paginationDir = config.pagination_dir || 'page'; const path = config.index_generator.path || ''; if(config.index_generator.exclude){ posts.forEach(element => { var mark=true; element.categories.forEach(function(categories){ config.index_generator.exclude_list.forEach(function(category){ if(categories.name == category){ mark=false; } }); }); if(mark){ temp_posts.push(element); } }); } return pagination(path, config.index_generator.exclude ? temp_posts : posts, { perPage: config.index_generator.per_page, layout: ['index', 'archive'], format: paginationDir + '/%d/', data: { __index: true } }); };
The text was updated successfully, but these errors were encountered:
I switch to automatic deployment, so I don’t need to modify the main program anymore, thanks
Sorry, something went wrong.
No branches or pull requests
_config.yml
generator.js
The text was updated successfully, but these errors were encountered: