Board Thread:Support Requests - Getting Technical/@comment-4023106-20130724205743/@comment-11733175-20130730005340

Oh, I understand now.

On runescape wiki, we use w:c:rs:Template:Mainonly to stop categories appearing outside of the mainspace, normally on category pages. It should work for mediawiki pages too. Feel free to borrow it if you want.

You'd use it like this:  which adds a category, but only in the mainspace.