Categories Missing from `categories.json` Despite Existing in the System (Custom Theme)

We’ve built a custom Discourse theme where specific categories are displayed on the homepage using JavaScript. The script uses a predefined list of category names (as a comma-separated array) to fetch and render content from /categories.json.

While most categories are displaying correctly, a few are missing from the homepage—even though they are explicitly listed in the script and exist in the system with valid category IDs.

Upon inspecting the /categories.json response, we found that these specific categories are not included in the API output at all. However, they:

  • Exist in the Discourse instance
  • Are top-level categories
  • Have everyone set with at least “See” permissions
  • Are not archived, hidden, or nested

We’re trying to understand:

  1. Under what conditions does Discourse omit categories from categories.json?
  2. How can we ensure all needed categories appear in that response, especially if we want to display them on the homepage via custom code?

Any insights or recommended solutions would be appreciated.

Not sure, but is this on /latest? Maybe it includes only categories that have topics in the topic list?

1 Like