Skip to content
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

Implementing JBake Categories Support #1

Merged
merged 2 commits into from
Jun 27, 2016
Merged

Conversation

manikmagar
Copy link
Owner

jbake-org#293

Implemented Categories Support for Posts.

Categories configuration controls -

  • template.category.file=category.ftl (This is for rendering individual category page)
  • template.categories.file=categories.ftl (This is for rendering all categories list page to prevent directory listing on {site.host}/categories/ url.
  • categories.enable=true
  • render.categories=true
  • category.default=Uncategorized
  • categories.path=categories
  • categories.sanitize=false

Adding categories in content

Add an attribute categories=Category1, Category2

  • If categories.enable is not false and no categories are provided for post then category.default is applied to post.
  • First category is also available with primary_category key in model.
  • If categories.enable is false and categories are still provided in content, then those are ignored with a warning in log.

Accessing categories in templates

  • all_categories - All categories from all published content. This variable is available on templates.
  • category_posts - On a single category page template.category.file, this variable is available and provides access to posts marked with category being displayed on page.

Extensionless Support

If uri.noExtension is set to true then all category pages are rendered without extension.

Test cases

Appropriate test cases have been added under src/test/java with its resources under src/test/resources.

@manikmagar manikmagar merged commit 85cbe6d into mm-jbake Jun 27, 2016
pull bot pushed a commit that referenced this pull request May 30, 2021
Use gradle:6.8-jdk11 as builder image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant