-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
848 hierarchical categories #2734
848 hierarchical categories #2734
Conversation
The code still needs some cleanup, but the new test passes without breaking the old ones.
added tests for category list and front-matter processor to include multiple categories; cleaned up Post.setCategories() code
…erarchical-categories
No fat arrow functions, huh? :) I'll have that pushed up momentarily. |
CodeClimate didn't like 'em...
Add reference #848 |
I realized that I didn't check for duplicate parents not being added. I wrote a test to check for that, and it passed with no code changes. I'll commit the test to this branch. |
ensure we do not create a duplicate post/category xref for duplicate parent categories
FWIW, the code here enabled me to move my tech blog, which is live here! |
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.
LGTM
@danieljsummers The live sample is really cool. This is also a major feature will in 4.0. #2492 Thanks for the contribution! |
Add reference: need to update hexo site when the feature released. hexojs/site#550 |
This implements the ability to have multiple category hierarchies attached to a single post (#848).
By default, everything works the way it currently does; a list of categories will be assembled for a single category hierarchy. The change implemented here is that, if a category is a list,
setCategories()
will switch into multiple category mode, and each top-level item in the list will be a category hierarchy itself.This will result in four different categories assigned to the post, with three different hierarchies (
example-1
,example-2
, andexample-3/subexample-3.1
). The category generator already created index pages for intermediate categories, so[url]/category/example-3/
is a good URL, and would contain this post.I have just forked/cloned the
site
repo, and will get the documentation for this change there. Additionally, I plan to look at the WordPress export format; if it exports the categories in their hierarchy, I'll see if I can PR a change to that migrator to bring the hierarchies over intact.