உதவி:துணைப்பக்கங்கள்
Lua error in Module:Header_structure at line 139: attempt to call upvalue 'plain_sister' (a nil value).
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 any other 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/1
- Foo/Bar/2
- Foo/Bar/3
- Foo/Baz
- Foo/Baz/1
- Foo/Baz/2
- Foo/Baz/3
- Foo/Baz/4
- Foo/Baz/5
- Foo/Bar
Foo is the top level "base page". Bar and Baz are subpages of Foo. Bar has three subpages of its own, each numbered 1 to 3. Baz has five subpages of its own, also 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, frotispiece 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 unmanagebaly 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.
Using subpages allows Wikisource to better manage works. Works are better organised and there is no need to track individual parts of a work separately. It is easier to manage an entire work in this way. For example, it is only necessary to categorise and licence the basepage, rather than individually; 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
தொகுChapters and sections
தொகு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
- Avon Fantasy Reader/Issue 1
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
தொகுNamespace | Template |
---|---|
Main | {{subpage-header}} |
Author | {{author subpage}} |
Wikisource | {{process subpage}} |
Help | |
Portal | {{portal subpage}} |
Subpages do not need to display as much information as the basepage. As a result, they have their own header templates. 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). The previous
and next
parameters should be used to link to the previous and next subpages. A full absolute wikilink[1] can be used but it may be simpler to use the following shortcut. If linking to a subpage, of the same basepage, with the name "Chapter 2", the relative wikilink [[../Chapter 2/]]
can be used. In most cases, the title
parameter should be the name of the full work and should also be a wikilink back to the basepage. Again, this can be a full absolute wikilink but the short [[../]]
link will work as well.
Other subpage templates
தொகுFunctions
தொகு- {{Is subpage}}: Can be used to detect if the current page is a subpage.
- {{R to subpage}}: Redirect sorting template for redirects to subpages.
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.
Detecting and using subpages in templates
தொகு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.
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 |
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):
{{#ifeq:{{BASEPAGENAME}} |{{PAGENAME}}<!-- check is BASEPAGENAME = PAGENAME --> |<!-- this is the basepage --> |<!-- this is a subpage --> }}
Parser functions
தொகு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 --> }}
Notes
தொகு- ↑ 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. A "relative" wikilink would be, for example,[[../Chapter 2/]]
, which will link to the subpage "Chapter 2" of the current parent page. If it were on[[Another Book/Chapter 1]]
instead it would link to[[Another Book/Chapter 2]]
.