One of the common questions that we get from owners of advanced Joomla websites is how to assign articles to multiple categories in Joomla. Our immediate answer to this question is that by default, Joomla does not allow assignment of an article to multiple categories (or sections). The answer we typically receive is “Why”, and “Is there a way to overcome this limitation?”. Let’s discuss each of these separately…
Why doesn’t Joomla allow the assignment of an article to more than one category?
One of the main reasons for this is SEF: By default, Joomla adds the category alias of the article to the URL. If Joomla allows you to assign your article to multiple categories, then which category alias should Joomla to display in the URL?
Another problem associated with the allowing of an article to have multiple categories is to avoid confusion. If a Joomla website owner who doesn’t have a lot of experience in Joomla decided to add his article to multiple categories, then his article will appear in several places on his website (which may or may not be what he desires).
Is there a way to overcome this limitation?
Jooma’s official website recommends a very bad way for dealing with this limitation, which is creating a duplicate article under the different category, which means that if you want to assign an article to 3 categories, then you have to create, and maintain, 3 versions of the same article. This will quickly turn into a nightmare if you have lots of articles on your website.
So, is there a better way to do this?
Yes, of course there is a better way – but it needs PHP programming on your Joomla website. What you can do is that you can modify the interface for the creation of a new article to allow users to select multiple categories (by changing the type of the select HTML tag containing the different categories to a list).
Modifying the interface is of course the first part, you will then need to modify the code that handles the adding and the displaying of the page on the website – not to mention, of course, slightly modifying the database structure for the join table between the categories and the articles.
Now here are several challenges and how to overcome them:
- How will SEF handle multiple categories? The key here is to create a function that will return the id of the first category that is assigned to the article. Of course, there is a caveat here that categories with lower IDs will appear most in the articles’ URLs. So, you should give your most important categories the lowest IDs. Now there’s always a way to go around this limitation, and it is by creating a new field called category weight in URL, which will be used when choosing the category to appear in the SEF (the category ID with the highest weight will be chosen – if there are two categories that have the same highest weight, then the category with the lowest ID will appear first).
-
How to avoid negative effects on the SEO of the website? When you have the same content appearing multiple times under different links, then you will have a problem with SEO (in fact, it is very possible that your website will be automatically flagged as a spam website by search engines which may penalize you). The solution to this problem is to always use the same URL with the same category to point to an article.
-
Will there be conflicts with 3rd party extensions? Some (badly coded) third party extensions might not expect this change in the core. These extensions need to be modified so that they can still work under this change.
-
Will the template still work? Same as 3rd party extensions, some templates need to be modified in order to accommodate this change.
As you can see, something that you initially thought of as a simple task in Joomla was not that simple after all. It needs some modifications to your Joomla’s core and database, as well as some potential modifications to some of its template and some of its extensions. If you find this job to be intimidating, then fear not, we are here to help. Just contact us and we’ll do all the work for you so that you’ll be able to assign your article to multiple categories. Our rates are very cheap so you don’t have to worry in that area! And we are very, very friendly!