Closed yeziahehe closed 6 years ago
Please see https://github.com/Jamling/hexo-generator-index2#options
v0.1.0 support multi-layout include/exclude
- layout: index
exclude: 'category'
such as I have three categories : a, b, c. And i only exclude c.
include:
- category a
- category b
exclude:
- category c
It is work for me. but if only use
exclude:
- category c
it does not work.
category_map is not used.
On my case: it should uninstall hexo-generator-index and set index2_include_index: false
@yeziahehe Please try the solution of @Yalhu
The default official hexo-generator-index
must uninstalled before using hexo-generator-index2
When I open the page: localhost:4000,there is an error: 'cannot get /' while I set index2_include_index:false
. Is index2_include_index:true
required rather than false
?
It was ok yesterday.
I think it was the code:var include = generator.include || []
indedicating it will include nothing if only using exclude. The include should be all of the categories of level 1 and uncategories what are default if there is no category rather than []
, while there is no include.
But I don't know how to change .
if (generator.include || generator.exclude) {
//There should include all categories of level 1
// and uncategories what are default if there is no category
var include = generator.include || [];
var exclude = generator.exclude || [];
if (!util.isArray(include)) {
include = [include];
}
if (!util.isArray(exclude)) {
exclude = [exclude];
}
posts = posts.filter(function (post) {
I'll check the code tomorrow
And run the test of when the include
is empty.
I just want to use exclude. But i remove include or include empty, exclude is not work.