-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
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
Add Tag index page #2
Conversation
will it override my tags new? |
No, just append to your generated pages or do nothing, controlled via tag_generator option: tag_generator:
per_page: 10
# append index page or do nothing
enable_index_page: true/false
# if enable_index_page: true, config template to use. ['tagIndex', 'tag', 'archive', 'index']
template: 'tagIndex' |
LGTM 👍 |
pages.push({ | ||
path: tagDir, | ||
layout: [tagConfig.template ? tagConfig.template : | ||
'tagIndex', 'tag', 'archive', 'index'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use:
[].concat(tagConfig.template, ['tagIndex', 'tag', 'archive', 'index']);
In this way, users will still have the template fallback when the template does not exist. Also I think tag-index
would be better than tagIndex
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion seems to be better. :)
@tommy351 I make a change after look through the source code of For template, it's of a particular sequence |
+1 |
@creeperyang I would like to use it but I can't manage to understand how to do it. Could you please explain ? I've set this in configuration :
And added a |
@borisschapira A little change done and now it's stable(merged). So currently the config is like: tag_generator:
per_page: 10
# append index page or do nothing ------ the only config option
enable_index_page: true/false
# template: 'tagIndex' ------ removed, default to 'tag-index', so use 'tag-index.ejs' instead. And the variables inserted into the template( {
base: tagDir,
total: 1,
current: 1,
current_url: tagDir,
posts: locals.posts, // all posts
prev: 0,
prev_link: '',
next: 0,
next_link: '',
tags: tags // all tags
} Last, I check via |
Thanks for the answer, it works. Maybe you should Pull-Request some evolution to the documentation with all of that info.
✋ You can reference the repo like that to get last commit on master 😄
|
@creeperyang Do you plan to do the same with hexojs/hexo-generator-category ? If yes, maybe you should harmonize the structure of data passed to |
@creeperyang : another note : you list all the tags, including the tags of non-published drafts (therefor, the tag page does not necessarily exists). I suggest you filter on |
@creeperyang : and maybe also add a configuration for desired order (alpha, length, reverse...). |
@borisschapira Good suggestions. But currentlly I have no time to do it. And I use |
Add tag index page generation for
hexo-generator-tag
.After generation, it would be like:
So like
/tag
menu will be supported.