plugin-category-cloud (A README Experience)

Category Cloud with Page Counts

A plugin for Micro.blog that creates a page displaying links to your categories layed out as a category cloud. Once installed, the generated page will be found at [SCHEME]://[HOSTNAME]/cloud/. Its code lives here. It is based upon the category cloud plugin you might already know and love that lives here.

Parameters

Plugin Interface

The plugin’s parameter interface looks like this:

Plugin Parameters

All of the plugin’s simple parameter values are settable via the interface. All of the simple parameters plus two additional parameters may be set via data file. For an understanding of how my plugins use data files, have a look at this post.

Data File

The template data file is located at data/plugin_category_cloud/params.toml and it looks like this (notice the comments describe what the parameters do):

Examples

ExclusionList

moondeer.blog is configured to include a Pinned category. None of the screenshots, however, happen to include such a category. The reason is that I have configured the value of ExclusionList like so:

DisplayPageCounts

The screenshot at the top shows a category cloud that includes parenthesized page counts. Configure the value of DisplayPageCounts like so:

And you get a category cloud that’s all:

Category Cloud without Page Counts

The CSS for the category cloud gets injected into the page head via layouts/partials/category-cloud-style.html:

The page count spans are always included. The value of DisplayPageCounts controls whether span.category-count elements get their display property set to initial or none. I figure this way it would be easy to toggle them on and off using Javascript should I ever feel the desire.

Humanize

Set Humanize to false and you get a cloud displaying the anchorized category names kinda like:

Non-Humanized

DisplayNames

Setting Humanize to true will only get you so far. Where I to revert DisplayNames to its default value:

I would end up with a category cloud that was all:

Without Display Names

By configuring DisplayNames to override a couple of troublesome category names:

I am able to put the period back into Micro.blog and correct the capitalization in the middle of Stream of Consciousness:

Category Cloud without Page Counts

By creating content files within a custom theme, it is totally possible to change the path to a category’s page. I happen to create files for all my categories so I am able to control various page level attributes. For categories that I also include in the main navigation menu, I also alter their URLs to remove /categories. Take the category page for Critters, for example:

Since the plugin generates URLs for the categories that include /categories by default, you can tell the plugin to check the main menu item URLs for an item whose URL’s last path component is equal to the category’s anchorized name. When a match is found, the menu item’s URL will be used in place of the default construction.

Page Configuration

The file living at content/cloud.md specifies the front matter for the page.

Leave the type alone (as that is what points it to layouts/cloud/single.html). You can play with the title and description values. These set the values I would expect your theme to draw from when constructing the page <head>.