Template:RootPage/doc View history

Revision as of 15:24, 17 July 2014 by Kentsmith9 (talk | contribs) (fixed)
This is a documentation subpage for Template:RootPage.
It contains usage information, categories and other content that is not part of the original template page.

This template uses the #titleparts parser function extension to extract only the root of the page name.

Usage

Place {{RootPage}} where the root of the current page name is desired. An optional parameter is a pagename other than the current pagename.

Pagename {{RootPage}}
USA/CommonState/Test USA
USA USA

Related versions

A special version of this template is {{RootPage2}} where it operates the same and {{RootPage}} except if the root page is USA it uses the second subpage. This enables the automation of USA/CommonState to display normally if it is the sample template or deployed on an actual state page without further modifications.

A related version of this template is {{BasePage2}} where it operates the same as {{RootPage2}} except it uses the basepage. The pages with "USA" respond the same, but all other pages return the basepage, with the exception of pages with "Main" (which stops at the basepage one level above it). This enables the automation of USA/CommonState to display normally if it is deployed on test pages. The state page can then be tested without affecting the original page and after testing is complete it can be moved along with all the subpages to the primary page.

Pagename {{RootPage2}} {{BasePage2}}
USA/CommonState/Test CommonState USA/CommonState
USA/CommonState CommonState USA/CommonState
USA/CommonState/Test/Test 2 CommonState USA/CommonState
Arizona/To do Arizona Arizona
Arizona/Test/To do Arizona Arizona/Test
Arizona/Test/To do/Main Arizona Arizona/Test
Arizona/Test/To do/Main/Preload Arizona Arizona/Test
Arizona/To do/Main/Preload Arizona Arizona