In the default Sphinx template it does work. Placing it outside the sidebar directive is no option because you wouldn't know where it would actually be rendered then.