Template:NAMESPACEID/doc

Returns the namespace ID of page given, or of the current page.

Usage

 * → (Article namespace)
 * → (Article namespace)
 * → (Article namespace)

Namespace aliases are accepted, too:

Invalid input returns an error, which can be caught with the #iferror parser function: