Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 37 ยท Articles and Categories

Categories and Nested Structures in Joomla

Plan and build Joomla category trees, understand nesting, paths, aliases, access and per-category settings, with a runnable tree builder.

Categories give your content structure. In Joomla every article has exactly one category, and categories can be nested inside each other, so you can model a hierarchy such as News > Company > Events. A good category tree makes navigation, permissions, URLs and maintenance easier; a messy one causes trouble for years, so this lesson is about planning as much as clicking.

The backend is described in words. The stand-ins build and print category trees so that you can think about structures with data.

Create a category

Go to Content > Categories and press New. The key fields are:

  • Title and Alias.
  • Parent: choose No parent for a top-level category, or another category to nest under it.
  • Status: Published, Unpublished, Archived, Trashed.
  • Access and Language.
  • Description: optional text and image that category views can show above the list.
  • Options: an image and layout choices.
  • Publishing: author, meta description, keywords and robots instructions for the category page.
  • Permissions: category-level rules (very useful later).

Categories are also used by other components. The Categories screen shows only those of the extension named in the header (articles by default); Contacts, Banners and News Feeds have their own category trees. You switch between them with the extension filter, or through the menu of the component.

Plan the tree

Before you click, sketch the site. These guidelines save work:

  • Keep it shallow. Two or three levels are normally enough. Deeper trees are hard for editors and visitors.
  • Categories group by purpose, tags group by topic. A category answers "where does this belong?"; tags answer "what is it about?" (see the tags lesson).
  • Name categories for visitors, not for internal teams.
  • Think about permissions. Whoever should be able to edit a section needs rights on its category, so split categories along who works on them.
  • Think about layouts. Each category can be shown as a blog or list; articles in one category share that menu item's presentation.
flowchart TD
    R["(root)"] --> N["News"]
    R --> H["Help"]
    N --> C["Company"]
    N --> I["Industry"]
    C --> E["Events"]
    H --> G["Guides"]
    H --> F["FAQ"]

A small tree with two top-level categories and three levels.

How nesting is stored

Joomla stores categories in the #__categories table using a nested set model, with lft and rgt numbers and a level for each row, plus a path column such as news/company/events. The nested set makes it quick to ask "give me all descendants of News" in one database query. You do not edit these columns; Joomla maintains them, and the Rebuild button in the toolbar recomputes them if they are damaged (for example after a faulty import).

The category path appears in URLs when the router includes categories, for example /news/company/events/summer-party.

JS Stand-in: build a category tree from rows

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The output prints an indented tree with the path of each category and a cumulative article count. This resembles what a category list view or a "show articles from child categories" option does.

Include sub-categories

When a menu item shows a category (blog or list), an option Include Subcategories controls how many levels below should be included in the output, for example "All" or "1". That is how a parent page such as News can show posts from Company and Industry without each being a separate menu item. The rule of thumb is: use one menu item per top-level area, and let subcategories appear within it.

Access, status and inheritance

  • Access on a category controls who can see the category and, through it, its articles. A Registered category hides its articles from guests, whatever their own access says, so check both levels.
  • Unpublishing a parent hides its children in lists as well, even if the children are marked Published.
  • Permissions can be set per category and are inherited by child categories unless overridden. That is why splitting categories along editorial teams pays off.

Batch and cleaning

On the Categories list screen, Batch lets you move or copy selected categories under another parent and change access and language. In the Articles list, batch Move or Copy relocates articles to another category. Before you delete a category you must move or trash its articles; Joomla refuses to trash a category that still has items (a protection against accidental data loss).

JS Stand-in: can this category be trashed?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The stand-in mirrors the logic: before you remove a branch, look at its articles and descendants.

Common mistakes

  • Too many levels, so the tree is hard to read.
  • Duplicating categories (News, news, Newsfeed) because nobody planned.
  • Using categories as tags, creating an article in five categories (not possible) and then wondering why; use tags.
  • Forgetting that access is combined: a public article in a Registered category is still hidden.
  • Renaming the alias after launch without a redirect, which breaks old links (see the SEO chapter).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How many categories can one article belong to?

    An article has exactly one category. Tags provide extra grouping.
  2. 2. What happens to children when their parent category is unpublished?

    A hidden parent hides its descendants in normal views.
  3. 3. Which toolbar button repairs the stored nesting data?

    Rebuild recalculates lft, rgt, level and path values.
  4. 4. Which is a good guideline for category trees?

    Shallow, clearly named trees are easier for editors and visitors.

Summary

  • Each article has one category; categories can be nested, and other components have their own trees.
  • Plan the tree first: shallow, visitor-friendly, and aligned with who edits what.
  • Joomla stores the tree as a nested set with a path; Rebuild repairs it.
  • Access, status and permissions apply across the tree and are inherited.
  • Move or copy with Batch, and empty a category before trashing it.

Next: Tags and Featured Articles