Adding many categories

Hello! Some colleagues and me are currently starting a page for my studies, where we want to make one category for each subject. Thus we have to add many many categories. Is there any possibility to automate this like giving Discourse a list with all names for the categories to add?

I am really thankful for every help! Thanks to all and greetings,
Jego

We have a guide for doing bulk options from the command line, including exporting/importing categories:

I’m not sure how many categories is “many many” but you might run into some performance issues (depending on how the categories are used) once you hit 500+. Using tags instead would avoid that.

3 Likes

Thanks for your reply, I have seen this page. I only see the possibility to import categories from a category file, is this right? Furthermore it appears to be quite difficult to export this file, manually add all categories and re-import it (or is this file different to the category part of the file https://meta.discourse.org/categories.json)?

Edit: Typo

You’ll want a script that does something like

   Category.create(title: "hello".....)

A bunch of times, it perhaps reads from a csv or something. You can type just the above with no arguments to get a hint.

You will probably be better off with tags than categories… see