Package: mkdocs-categories-plugin
mkdocs-categories-pluginAn MkDocs plugin allowing for categorization of pages in your wiki. This plugin allows for multiple categories per page and will generate a category index page with links to each page within the category.If you like this MkDocs plugin, you'll probably also likemkdocs-alias-pluginandmkdocs-live-edit-plugin.InstallationUsing Python 3.10 or greater, install the package using pip:pipinstallmkdocs-categories-pluginThen add the following entry to the plugins section of yourmkdocs.ymlfile:plugins:
  - categoriesImportant:If you already have a directory namedcategoriesin your project's root directory or a section namedcategories, you must change thebase_nameoption to something else in order to prevent issues or data loss.For further configuration, see the Options section below.UsageAdd acategoriessection to your page's meta block:---categories:-Novels-Fiction-19th Century Gothic Fiction---New pages will be generated for each of these categories, with a list of links to each of the wiki pages within the category. Subcategories, links to the parent category, and a link to the "All Categories" page are automatically generated and placed on the page.Category names are slugified before used in category URLs. For example,19th Century Gothic Fictionbecomes19th-century-gothic-fiction.Please refer to theMkDocs documentationfor more information on how the meta-data block is used.SubcategoriesAs of version 0.3.0, mkdocs-categories-plugin supports subcategorization. This is achieved by supplying a category name that separates parent from child categories using a separator (by default|, configurable viacategory_separator). You may supply as many levels of child categories as you like.For example:categories:-Fiction|Romance-Fiction|Books|British Authors|Female|19th CenturyThe first category definition in this example places the page in theRomancesubcategory of theFictionparent category. Note that the page willnotbe placed in the parent category ofFiction, but only in theRomancecategory. The second category definition places the page in the19th Centurycategory, but not in any of its ancestor categories.OptionsYou may customize the plugin by passing options into the plugin's configuration sections inmkdocs.yml:plugins:-categories:generate_index:trueverbose:falsebase_name:'categories'section_title:'Categories'no_nav:falsecategory_separator:'|'generate_indexDefault:trueIf true, an index page listing all of the generated categories is created at thebase_nameURL.verboseDefault:falseYou may use the optionalverboseoption to print more information about which categories were defined during build and how many in total.base_nameDefault:categoriesA string that's used to both serve as the URL base for the category pages as well as the navigation section that's automatically generated. Since this string is used in the generated category URL, please ensure that it only contains URL-friendly characters.section_titleDefault:CategoriesThis is the string that's used to render the H2 header at the bottom of each page that defines categories. It is followed by a list of links to each category.no_navDefault:falseBy default, mkdocs-categories-plugin will generate navigation entries for each category page under thebase_namethat you provided. If you want to turn this behavior off, set this option totrue.There's also a know issue with mkdocs-awesome-pages-plugin compatibility that does not allow you to reorder the position of the generated categories section by using a.pagesfile. If you would rather turn the navigation entries off entirely, this option is for you.category_separatorDefault:|This string is used to split the category name in order to define a category hierarchy (see subcategories above).TroubleshootingThere's a directory namedcategoriesin my projectA fatal error must have occurred during the compilation of your site and left the temporary directory containing the intermediate markdown files used by this plugin behind. It is safe to delete this directory since it's only used during the build.The categories object at URL was not a list, but TYPEThe page identified did not contain a valid categories configuration object. Please make sure that this is an array of strings.Changelog0.5.0Fixes many build info warnings about absolute paths due to MkDocs' improved validation. Made the links that are generated more correct.0.4.0Fixes sorting categories, child pages, etc. containing numbers by using natural sorting from thenatsortpackage rather than the default sorting function.0.3.0Added support for subcategories. Python 3.10 or higher is now required.0.2.1Patch release: implements a bug fix by @rpmzandwijk reported in#1.0.2.0Introduces support for the automatic generation of category index pages. This new default behavior can be turned off using an option.0.1.1Fixed a breaking bug caused by passing the wrong data intosorted.0.1.0Initial release with all of the base logic in place.