Working on support for categories today. There are a few functional goals we’re trying to solve with this:
- We can list all categories used on a blog
- We can quickly filter all posts under a certain category
- We can create tags with specific capitalization, Unicode characters, and spaces in the name
- We can associate posts with certain categories via existing plain text tagging system
The last point in particular is pretty tricky to solve; all other points are solved easily by adding some new data structures. I’m thinking we’ll just store three pieces of data for each category: a slug (e.g.
united-states), a title (e.g.
United States), and a normalized “lookup slug” that can be represented by a hashtag (e.g.
Then we’ll do some magic on the backend when creating or updating a post that parses the post and creates a new category automatically and / or associates the post with an existing category. That will allow existing posts to use this new categorization system. Then we might also support a new “silent” way of adding categories via a new API field, so you can associate a post with a category without inserting it into the body of the post.
Just some implementation ideas so far; we’ll see if this works in practice.