848 hierarchical categories#2734
Merged
NoahDragon merged 6 commits intohexojs:masterfrom Sep 5, 2017
danieljsummers:848-hierarchical-categories
Merged
848 hierarchical categories#2734NoahDragon merged 6 commits intohexojs:masterfrom danieljsummers:848-hierarchical-categories
NoahDragon merged 6 commits intohexojs:masterfrom
danieljsummers:848-hierarchical-categories
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
Contributor
Author
|
No fat arrow functions, huh? :) I'll have that pushed up momentarily. |
CodeClimate didn't like 'em...
Member
|
Add reference #848 |
Contributor
Author
|
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
Contributor
Author
|
FWIW, the code here enabled me to move my tech blog, which is live here! |
Member
|
@danieljsummers The live sample is really cool. This is also a major feature will in 4.0. #2492 Thanks for the contribution! |
Member
|
Add reference: need to update hexo site when the feature released. hexojs/site#550 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
siterepo, 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.