Skip to content Skip to sidebar Skip to footer

Grouping Categories In Hexo

I would like to group categories in hexo. While the hexo <% list_categories %> helper lists all my categories alright, I would like to group nested categories right. My quest

Solution 1:

  1. In Hexo v3.3.9 added hierarchical categories feature. Need to update hexo/node_modules/hexo/lib/models/post.js by this commit (or newer if exists). And set categories like this (in *.md):

    categories:
    - [sport, motosport]
    - [sport, cricket]
    - [sport, basketball]
    - [sport, hockey]
    
  2. <%- list_categories() %> without any parameters enumerate parents and their childs already in hierarchical list; <%- list_categories(site.categories, {depth: 1}) %> enum only parents (sport) of site total, etc. Full options for now here.

Post a Comment for "Grouping Categories In Hexo"