Move namespace check down, to not add sidebar link where not used
Check the namespace and existence earlier in the process in order to not add the sidebar link when it's not actually able to be used.
Bug: T347542
How to register an account on GitLab. To prevent spam, new accounts are locked until approved by an admin or the approver bot. You can also file an unlock request to expedite access.
Support: mw:GitLab, how to host a project on GitLab, #wikimedia-gitlab on libera.chat, #GitLab on Phabricator.
Check the namespace and existence earlier in the process in order to not add the sidebar link when it's not actually able to be used.
Bug: T347542