Manual:Page title/pl

From Linux Web Expert

Revision as of 06:40, 24 January 2024 by imported>FuzzyBot (Updating to match new version of source page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A page title, also page name, is the title of a wiki page as stored in the page table and represented by the Title object. It is uniquely identifiable within the scope of the wiki and serves a number of critical purposes:

  • as the human-readable text title of the page
  • as the basis of the URL used to access the page
  • as the wikitext link to the page
  • as the key into the page database.

In order of appearance, the possible building blocks of a page title are:

  1. An optional Interwiki prefix, such as mw: for pages from mediawiki.org or w: for Wikipedia articles
  2. A namespace prefix, such as Manual:, if the page belongs to a namespace other than the mainspace.
  3. The non-optional page name proper, which itself consists of a base name and possibly, a subpage name.
  4. An optional fragment beginning with a hash sign (#)
prefix: namespace: page name
optional optional required

When one is specifying a certain page by typing it into the search box, or putting it in an article as a wikilink, the input consists of a Podręcznik:Przestrzeń nazw (or no namespace, if it's mainspace) followed by a colon (optional if it's mainspace) and then the database key. For example, Manual:Page table specifies the Manual: namespace and the page table database key.

#1 and #2. Interwiki prefixes and namespace prefixes

Interwiki prefixes and namespace prefixes follow the same content rules:

  • they must start with a letter
  • they must end with a colon
  • they may only contain digits, letters, the space character and the underscore character
  • spaces and underscores may be used interchangeably
  • they are case-insensitive

Interwiki prefixes and namespaces are only recognized if they are known to a given installation of MediaWiki, either by default or through configuration.

For example: On this wiki, "w:Name" is a link to the article "Name" on Wikipedia, because "w" is recognized as one of the allowable interwiki prefixes. The title "talk:Name" is a link to the article "name" in the "talk" namespace of the current wiki, because "talk" is a recognized namespace. Both may be present, and if so, the interwiki must come first, for example, "w:talk:name".

If a title begins with a colon as its first character, no prefixes are scanned for, and the colon is removed before the title is processed. Because of this rule, it is possible to have articles with colons in their names. "E. Coli 0157:H7" is a valid title, as is "Commandos: Behind Enemy Lines", because "E. Coli 0157" and "Commandos" are not valid interwikis or namespaces.

#3. The title proper

The title proper is sometimes called the article name (although not every wiki page is necessarily an article).

Naming restrictions

Certain naming restrictions apply to the title proper.

By default, the page title is case-sensitive except the first character. You can set $wgCapitalLinks to false to make the first character case-sensitive. However, it's currently impossible to make the page title completely case-insensitive (phab:T2453).

The following are not valid as page titles:

  • Base names beginning with a lower-case letter (in any alphabet), unless $wgCapitalLinks is set to true.
  • Titles containing any of the following characters
    • # < > [ ] | { } _ (which have special meanings in Wiki syntax)
    • the non-printable ASCII characters 0–31
    • the "delete" character 127
    • HTML character codes such as &amp;
    • Note that the plus sign + is allowed in page titles, although in the default setup for MediaWiki it is not.
  • Special characters like ( ) & + are translated into their equivalent %-hex notation
  • Base names beginning with a colon (:).
  • Base names equal to "." or "..", or beginning "./" or "../", or containing "/./" or "/../", or ending "/." or "/..".

Be aware that non-ASCII characters may take up to four bytes in UTF-8 encoding, so the total number of characters you can fit into a title may be less than 255.

  • Titles containing "Talk:" in front of a namespace.
  • Titles with an invalid UTF-8 sequence.
  • Titles beginning with a namespace alias (WP:, WT:, Project:, Image:, on Wikipedia).

For example, the name Project:About is not possible if Project: is set as a namespace alias.

For example, an article about the album "Q: Are We Not Men? A: We Are Devo!" cannot have that exact name, as the "q:" prefix leads to Wikiquote. (The restriction includes the prefixes "w:" and "en:" that refer to English Wikipedia itself. This self-reference restriction does not apply on all projects. For example, Wikiquote supports titles beginning "Q:".) A list of all these interwiki prefixes can be found on Special:Interwiki.

  • Titles beginning with any non-standard capitalization of a namespace prefix, alias or interwiki/interlanguage prefix, or any of these with a space (underscore) before or after the colon.

For example, it is not possible for a title to begin such as: "HELP:", "HeLp:", "Help :", "Help:_", and the like.

  • Titles consisting of only a namespace prefix, with nothing after the colon.
  • Titles beginning or ending with a space (underscore), or containing two or more consecutive spaces (underscores).
  • Titles containing 3 or more consecutive tildes. (~~~)
  • A title can normally contain the character %.

However it cannot contain % followed by two hexadecimal digits (which would cause it to be converted to a single character, by percent-encoding).

  • Note also that it is not possible for editors to create page titles beginning with the virtual namespace prefixes Media: and Special:.

Special cases

  • By default, titles starting with a lowercase letter are automatically converted to leading uppercase.

Alternative per-namespace configurations are possible. See $wgCapitalLinks and $wgCapitalLinkOverrides .

  • The magic words PAGENAME and FULLPAGENAME return encoded strings in which some types of characters, such as apostrophes, are converted to numeric character sequences. This means that while apostrophes are perfectly valid in page names, you may encounter issues when reusing those strings for some purpose.

One simple way to fix this is wrapping the pagename in {{#titleparts:}} from the ParserFunctions extension.


#4. The title fragment

A title may end with a title fragment (also link fragment), which begins with a hash sign (#).

  • It is used by MediaWiki core to identify a section on a page, which typically derives its name from a sanitised version of the heading. See the docs on section editing .
  • It also is used by the Semantic MediaWiki extension to identify 'subobjects'.

Encoding

  • Spaces and underscores are treated as equivalent and each is converted to the other in the appropriate context (underscore in URL and database keys, spaces in plain text).
  • "Extended" characters in the 0x80..0xFF range are allowed in all places, and are valid characters.
  • They are encoded in URLs. Extended characters are not urlencoded when used as text or database keys.
  • Other characters may be ASCII letters, digits, hyphen, comma, period, apostrophe, parentheses and colon.
  • No other ASCII characters are allowed, and will be deleted if found (they will probably cause a browser to misinterpret the URL).

Canonical forms

The canonical form of a title will always be returned by the Title object. Canonicalization involves the following:

  • Certain Unicode directional characters (left-to-right mark, etc.) are stripped, since that usually results from errant copy-and-paste.
  • Everything from # onward is stripped, since that's used for section links.
  • Sequences of underscores and/or certain whitespace characters are collapsed into a single underscore (for the URL and DBkey forms) or a single space (for the text form). At the beginning or end of the title (or namespace or interwiki prefix), these are stripped.
  • Recognized interwiki prefixes are canonicalized, meaning that they're put entirely in lowercase.
  • Recognized namespace-names are canonicalized, meaning that the first character is capitalized and subsequent characters are put in lowercase. (This is not done for interwiki-links, however.)
  • Depending on the wiki and the namespace, the first character of a title may be capitalized. (This is not done for interwiki-links, however.)
  • For links to user-pages of anonymous users, the IP address is canonicalized.
  • The canonicalization process also includes some validation logic to reject various kinds of invalid titles (such as ones that are too long, or that contain illegal characters).

Related concepts

Display title

A page title is not to be confused with a Display title , which is the preferred label associated with a page. By default, a display title is synonymous with a page title, but it can be changed or customised to suit particular needs.

Zobacz też