User blog comment:Ursuul/Smart Templates: Categories/@comment-28083312-20171211052624/@comment-28083312-20171212170529

I considered doing that, but this was meant to be entry-level & so I thought not to get into it / make the blog longer than it already is. That said, for those who cared to scroll down this far, this is how you might program a template to only categorize pages in the main namespace:

If  is used in the main namespace, it returns nothing at all, so only   matters. Putting  into the template would be read as   by the switch & so it would apply a category. Now in the  namespace for example, the full result examined by the switch might be something like. Since  does not match ,  , or  , then the switch function does nothing & no categories are applied.