Template:Retitle: Difference between revisions

From OniGalore
Jump to navigation Jump to search
No edit summary
(updating doc which was long out of date; ai2_allpassive is not a redirect anymore, and this template is also used to change capitalization)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{{title|{{{1}}}}}}}}<noinclude>
<includeonly>{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{{title|{{{1}}}}}}}}</includeonly><noinclude>MediaWiki has a few technical limitations, which are catalogued [[wikipedia:WP:NCTR|here]]. One of these restrictions is that the URL for an article cannot contain spaces. Therefore, an article about Jimmy Carter must be placed at <nowiki>"https://en.wikipedia.org/wiki/Jimmy_Carter"</nowiki>. As a workaround for the fact that this would lead to an article with the name "Jimmy_Carter", the MW software automatically converts the underscores in the URL to spaces in the title of the article. In other words, MW assumes that you didn't really want that underscore to be there, so it "makes it better" by giving you spaces everywhere that it see underscores. It also assumes that all page titles ought to be capitalized. Sometimes these are undesired behaviors.
----


<center>'''''IMPORTANT!  THIS TEMPLATE SHOULD NEVER BE SUBST'D.'''''</center>
For instance, our wiki has numerous pages documenting BSL commands which are lowercase and actually have underscores in their names, e.g. [[ai2_allpassive]]. If that page wasn't employing this template, its title would be "Ai2 allpassive". This is purely an aesthetic concern, of course, but it definitely looks weird. To stop MW from changing the underscores and capitalization in a page's title, you can supply your own page title with <nowiki>{{Retitle|proper_page_title_here}}</nowiki> anywhere in the markup of a page with that name, and voila! your underscore will be in its rightful place in the title and the page will start with a lowercase letter.


'''''DO NOT USE THIS UNLESS ALLOC UPDATES THE WIKI SOFTWARE'''''
Note that this template actually allows you to do much more than preserve underscores and capitalization. Hypothetically, you can use it to completely re-title a page, but the abilities of this template are determined by the value of <tt>$wgRestrictDisplayTitle</tt>. If it is set to true, you cannot supply a new title that does not evaluate as "equivalent" to the old one, such as "'''ai'''_allpassive". You can only change capitalization and punctuation like the underscore. However, if <tt>$wgRestrictDisplayTitle</tt> is false, you can supply this template with any string and the page will be retitled as desired.


</noinclude>
* '''Attention: Please do not [[wikipedia:WP:SUBST|Subst:]] this template. MediaWiki's article-titling abilities may improve or change in the future.'''
 
[[Category:Basic formatting templates]]</noinclude>

Latest revision as of 22:27, 11 May 2017

MediaWiki has a few technical limitations, which are catalogued here. One of these restrictions is that the URL for an article cannot contain spaces. Therefore, an article about Jimmy Carter must be placed at "https://en.wikipedia.org/wiki/Jimmy_Carter". As a workaround for the fact that this would lead to an article with the name "Jimmy_Carter", the MW software automatically converts the underscores in the URL to spaces in the title of the article. In other words, MW assumes that you didn't really want that underscore to be there, so it "makes it better" by giving you spaces everywhere that it see underscores. It also assumes that all page titles ought to be capitalized. Sometimes these are undesired behaviors.

For instance, our wiki has numerous pages documenting BSL commands which are lowercase and actually have underscores in their names, e.g. ai2_allpassive. If that page wasn't employing this template, its title would be "Ai2 allpassive". This is purely an aesthetic concern, of course, but it definitely looks weird. To stop MW from changing the underscores and capitalization in a page's title, you can supply your own page title with {{Retitle|proper_page_title_here}} anywhere in the markup of a page with that name, and voila! your underscore will be in its rightful place in the title and the page will start with a lowercase letter.

Note that this template actually allows you to do much more than preserve underscores and capitalization. Hypothetically, you can use it to completely re-title a page, but the abilities of this template are determined by the value of $wgRestrictDisplayTitle. If it is set to true, you cannot supply a new title that does not evaluate as "equivalent" to the old one, such as "ai_allpassive". You can only change capitalization and punctuation like the underscore. However, if $wgRestrictDisplayTitle is false, you can supply this template with any string and the page will be retitled as desired.

  • Attention: Please do not Subst: this template. MediaWiki's article-titling abilities may improve or change in the future.