Subcategory names unique rules?

It seems that subcategory titles and slugs only have to be unique within their parent category.

It is possible for subcategories in different categories to have the same slug (and title)

Is this a good idea? Is there a separate categoryID that we don’t see anywhere that is used as a key field?

I can understand that it is useful to have the same title for a subcategory in different places (for example many categories might have a “Help” category, but shouldn’t the slug at least be unique (perhaps simply by automatically adding a numeric suffix if the slug derived from the name turns out not to be unique)

It causes a problem in the Category Icons Component where the slug is assumed to be available as a unique key to the category.

It has previously caused a problem in this bug

Is this actually a bug? Or are there good reasons to allow subcategories to have the same slugs?

2 Likes

I’m interested in this because I have forums where each category is used by a different group. In the main, categories will have the same sub-categories so this issue will arise when I use the Category Icon theme component. But it seems likely that all the duplicated subcategories will have the same icon and other settings so I probably won’t notice the underlying problem you describe.

I don’t like the theme component assuming unique slugs when they are not. But I can’t think why I would have different icon requirements for subcategories with matching slugs.

2 Likes

You might want the help subcategory under the finance category to have a different icon to the help subcategory under technical. Perhaps you might like all subcategories to use the same or similar icons to their parent category.

2 Likes