{{When in sandbox (|…) (|…)}} = {{When pagename is |/sandbox={{{1|/sandbox}}} |other={{{2|}}}}}

Returns "/sandbox" – or, if supplied, the first unnamed parameter – if the template detects that the page where it is transcluded is a subpage named "sandbox" (i.e. is a sandbox page); otherwise it returns nothing – or, if supplied, the second unnamed parameter.

This can be useful to e.g. switch the version of a template used in its /doc[umentation] to the sandbox version – by using {{template_name{{\sandbox}}}} – when that documentation is transcluded on the template's sandbox page.