From Wikisource
Jump to navigation Jump to search

Documentation for the use of subpages on Wikisource.

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[edit]

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.


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.


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

Use of subpages[edit]

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.

When to use subpages[edit]

Chapters and sections[edit]

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


For example:

  • Yule Logs
    • Yule Logs/A Fighting Mermaid
    • Yule Logs/A Frenchman's Gratitude


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[edit]

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[edit]

Subpage header templates
Namespace Template
Main {{header}}
Author {{author subpage}}
Wikisource {{process subpage}}
Portal {{portal subpage}}

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 previous and next parameters are used to link to the previous and next subpages. They may contain an absolute wikilink[1] but, since the link is to another subpage of the currently active basepage, a relative wikilink[2] may be simpler. In most cases, the title parameter should be the name of the full work and should also be a wikilink back to the basepage.

Other subpage templates[edit]


  • {{Is subpage}}: Can be used to detect if the current page is a subpage.


  • {{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.

Detecting and using subpages in templates[edit]

Magic words[edit]

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.

Magic word Function Sample result
{{PAGENAME}} Gives the full page name Foo/Bar/Baz
{{BASEPAGENAME}} Gives the name of the page(s) preceding the current subpage Foo/Bar
{{SUBPAGENAME}} Gives the name of the current subpage only Baz
{{FULLPAGENAME}} Gives the full page name with the canonical namespace Help:Foo/Bar/Baz

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

  |{{PAGENAME}}<!-- check is BASEPAGENAME = PAGENAME -->
  |<!-- this is the basepage -->
  |<!-- this is a subpage -->

Parser functions[edit]

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

{{#titleparts:pagename|number of segments to return|first segment to return}}

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

{{#titleparts:{{PAGENAME}}|1|3}} = Baz

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

Note that {{#titleparts:{{PAGENAME}}|1|1}} 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:

{{#if:{{#titleparts:{{PAGENAME}}|1|2}}<!-- check if this is a subpage -->
  |<!-- this is a subpage -->
  |<!-- this is not a subpage -->


  1. An "absolute" wikilink would be, for example, [[My Book/Chapter 2]], which will always link to the same page regardless of where it is on Wikisource.
  2. A "relative" wikilink would be, for example, [[../Chapter 2/]], which will link to the subpage "Chapter 2" of the current work. If the current page is [[Example Book/Chapter 1]], it will link to [[Example Book/Chapter 2]]. If the current page is [[Another Book/Chapter 1]], it will link to [[Another Book/Chapter 2]].