Help:Subpages

Wikisource uses subpages in its main namespace, as well as some others, which is rare in Wikimedia projects. These notes describe how this works, when to use them and how to use them.

Recognising subpages
Subpages can be recognised by the forward-slashes in the page title. These work like a webpage url or the file directory system on a computer. If the page title is Foo/Bar then page "Bar" is a subpage of page "Foo". There can be multiple levels of subpages and more than one subpage at each level. For example:
 * Foo
 * Foo/Bar
 * Foo/Bar/Chapter 1
 * Foo/Bar/Chapter 2
 * Foo/Bar/Chapter 3
 * Foo/Baz
 * Foo/Baz/Chapter 1
 * Foo/Baz/Chapter 2
 * Foo/Baz/Chapter 3
 * Foo/Baz/Chapter 4
 * Foo/Baz/Chapter 5

Foo is the top level "base page". Bar and Baz are subpages of Foo. Bar has three subpages of its own, numbered 1 to 3. Baz has five subpages of its own, numbered 1 to 5.

Terminology
Basepage or Rootpage
 * The top-level page for each work. Typically this may contain a table of contents with links to each subpage.  It may also contain any front matter from the original work, such as the title page, frontispiece, and so forth.

Subpage
 * Each page below the basepage, containing a chapter or other unit of the work.

Use of subpages
Subpages are used in the main namespace of Wikisource to combine a single work under one heading without making any single page unmanageably large. Any chapter or section of a work should have a separate subpage. Works that are collections, such as a collection of poetry or an encyclopedia, should have a separate subpage for each work, poem, article or entry.

Subpages keep Wikisource better organised and help Wikisourcers better manage works. For example, categorising or licencing a basepage does the same for its subpages; the entire work can moved, retitled or otherwise maintained with one action; templates can be created to navigate and recognise subpages; and so forth.

Chapters and sections
Chapters, sections and so on should be numbered with Arabic numerals (i.e. 1, 2, 3; not Roman numerals) when such a numbering scheme exists in the original work. For example:


 * My Book
 * My Book/Chapter 1
 * My Book/Chapter 2

Collections
For example:
 * Yule Logs
 * Yule Logs/A Fighting Mermaid
 * Yule Logs/A Frenchman's Gratitude

Periodicals
For example:
 * Avon Fantasy Reader
 * Avon Fantasy Reader/Issue 1
 * Avon Fantasy Reader/Issue 1/The Voice in the Night
 * Avon Fantasy Reader/Issue 2
 * Avon Fantasy Reader/Issue 2/The Mirrors of Tuzun Thune
 * Avon Fantasy Reader/Issue 2/The Yellow Sign

How to create subpages
We suggest that you firstly create the basepage. The basepage should list all subpages as red links. If you are publishing a scanned book with an index, you should add the red links as part of its formatting and transclude it. Then click on the red links and create the subpages.

Subpages and header templates
Subpages do not need to display as much information as the basepage. As a result, namespaces have their own header templates for subpages. Note that the basic header can be used on subpages and some of its functions will automatically be disabled if used on one.

Header templates are useful for navigation between subpages, especially in the main namespace where there are likely to be many subpages in sequence (one for each chapter or other subsection). Within the templates, the  and   parameters are used to link to the previous and next subpages. They may contain an absolute wikilink but, since the link is to another subpage of the currently active basepage, a relative wikilink may be simpler. In most cases, the  parameter should be the name of the full work and should also be a wikilink back to the basepage.

Functions

 * Is subpage: Can be used to detect if the current page is a subpage.

Maintenance

 * Move to subpage: To be placed on basepages that should be subpages of another basepage. Complemented by Merge subpages.
 * Merge subpages: To be placed on a basepage that should have subpages (that are currently other basepages). Complemented by Move to subpage.
 * Split: To be placed on basepages the are too long and should be split into a basepage and one or more subpages.

Magic words
The following "magic word" variables are useful when working with subpages. The sample results apply to a page named Foo/Bar/Baz—that is page Baz, which is the subpage of Bar, which is the subpage of Foo.

Example – The following snippet of code can be used to detect if a page is a subpage by checking if the and  are the same (this will only occur on a basepage):



Parser functions
The parser function #titleparts can be used to read page titles with more precision and flexibility.

For example, to read the 3rd segment of pagetitle on subpage Foo/Bar/Baz:


 * = Baz

This function will work up to 255 characters and 24 levels of subpages.

Note that  will always give the basepage name, regardless of whether or not it used on a basepage or subpage, nor how deep the subpage is. This cannot be done with magic word variables.

Example – The following snippet of code can be used to detect if a page is a subpage by checking for the existence of at least a second part to the pagename:

