Open main menu

MediaWiki β

This page is a translated version of the page Help:Subpages and the translation is 41% complete.

Other languages:
العربية • ‎català • ‎Deutsch • ‎Zazaki • ‎English • ‎español • ‎فارسی • ‎suomi • ‎français • ‎हिन्दी • ‎Bahasa Indonesia • ‎italiano • ‎日本語 • ‎한국어 • ‎मैथिली • ‎polski • ‎پښتو • ‎português • ‎português do Brasil • ‎русский • ‎سنڌي • ‎සිංහල • ‎slovenčina • ‎српски / srpski • ‎Türkçe • ‎українська • ‎中文
PD 注意:当您编辑本页面时,即代表同意以CC0协议授权您的贡献。您可以在公有领域帮助页面找到更多信息。
PD

"子页面"将层次化的组织引入到wiki页面中,层次结构以斜线'/'分隔

工作场所

默认情况下,MediaWiki的子页面特性在主命名空间是被关闭的,但可以使用talk pagesuser pages。参见Help:Namespaces 中对命名空间的描述,$wgNamespacesWithSubpages了解如何修改此默认行为。在此功能关闭的命名空间中,页面名称中的任何正斜杠(/)只是页面名称的一部分,不做任何特殊操作。

当在命名空间中启用子页面时,页面标题中的正斜杠总是使页面成为一个子页面,即使这不是有意的或不可取的

由于在启用子页面时,正斜杠是保留字符的结果,可能需要替代字符。反斜杠(\)在子页面命名中被视为普通字符,可以用于代替正斜杠。

  1. 如果没有使用必要字体将无法正确查看到字符;
  2. 必须创建使用斜杠从标题重定向,以便链接和搜索将正常工作。
  3. Both the subject and talk versions of a page (and their corresponding subpages, e.g. discussion archives) need to use the hack, so that moving a page would take all connected pages to the new title (if that setting is selected during the move). For example, subpages are disabled in the main namespace in Wikipedia, so while the talk page won't work unless the solidus character is used to prevent having them marked as subpages, the corresponding page in the main namespace could accidentally keep an actual slash. The risk is that the visual similarity might make this go unnoticed by human editors.

工作原理

Slashes (/) within a page name break the page into parent and subpages, recursively, e.g.:

You can link directly to any page’s subpage using the normal double square brackets notation, by providing the full name – including the slash(es) and the individual subpage name(s). You can also link from one page to one of its own subpages using certain shortcuts, which are covered at Help:Links.

There are Magic words to split the name of a subpage, such as {{BASEPAGENAME}} and {{SUBPAGENAME}}, and the parser function {{#titleparts:}} for finer control.

Note that the part of page names after a slash is case sensitive including the first letter.

Breadcrumb links will appear automatically at the top of the subpage, linking to each parent page that exists. These links do not appear, however, if the parent pages have not yet been created or if the subpage feature is turned off.

As these automatic breadcrumb links are not in the page content, the breadcrumbs do not place parent pages in the What links here and Related changes lists.

子页面的用途

There are various uses for the subpage feature. Some of the typical usages of subpages are:

  • to create archives of old discussions under a talk page
  • to create scratchpad editing spaces under a user page
  • to create other language versions of a document in multilingual wikis
  • to create a template's subpages for its documentation, for its code sandbox, for its testcases, and for any subtemplate code

Subpages are useful for organising information hierarchically. On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible. You can also organize pages with the category feature, which is more suitable for creating a hierarchical network of information.

子页面展示

Subpages can be listed very plainly by transcluding Special:PrefixIndex, like this:

{{Special:PrefixIndex/Help:Subpages/}}

Which produces this:

Since the magic word {{FULLPAGENAME}} outputs the current page, the general wiki markup to show all subpages of the current page is {{Special:PrefixIndex/{{FULLPAGENAME}}/}}. You can pass parameters to this, e.g. {{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}

The subpage extensions, such as Extension:SubPageList, let you customize the display of subpages.

另见