Template:Retitle: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (Iritscen moved page Template:Underscore to Template:Retitle without leaving a redirect: This template can either totally retitle an article or else it can only alter things like an underscore in the title, depending on $wgRestrictDisplayTitle, ...)
(actually it all depends on what $wgRestrictDisplayTitle is set to)
Line 1: Line 1:
<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. As a "smart" workaround for the fact that this would lead to articles with names like "Jimmy_Carter", the MW software automatically converts the underscores in the URL to spaces in such places as the title of the article at the top of the page. 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 can. Sometimes this is undesired behavior.
<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. As a "smart" workaround for the fact that this would lead to articles with names like "Jimmy_Carter", the MW software automatically converts the underscores in the URL to spaces in such places as the title of the article at the top of the page. 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 can. Sometimes this is undesired behavior.


An example from our own wiki, look at the {{noredirect|ai2_allpassive}} page. Ignoring that this is a redirect page, notice that the page title is displayed with a space in it, even though the underscore actually belongs there. This is purely an aesthetic concern, of course, but it definitely looks weird. To fix such a page, you would put <nowiki>{{Underscore|ai2_allpassive}}</nowiki> anywhere in the markup, and voila! your underscore is in its rightful place in the title. Note that you cannot supply a new title that does not evaluate as "equivalent" to the old one, such as "'''ai'''_allpassive".
An example from our own wiki, look at the {{noredirect|ai2_allpassive}} page. Ignoring that this is a redirect page, notice that the page title is displayed with a space in it, even though the underscore actually belongs there. This is purely an aesthetic concern, of course, but it definitely looks weird. To fix such a page, you would put <nowiki>{{Retitle|ai2_allpassive}}</nowiki> anywhere in the markup, and voila! your underscore is in its rightful place in the title.


Note that this template is not a simple reversal of MW's "smart fix"; if you have a page called, let's say, "Using ai2_spawn", you would write <nowiki>{{Underscore|Using ai2_spawn}}</nowiki> and the page name would continue to display the space after "Using", while putting back the underscore that you wanted to keep.
Note that the abilities of this template are affected by the setting 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 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.


* '''Attention: Please do not [[wikipedia:WP:SUBST|Subst:]] this template.'''
* '''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>
[[Category:Basic formatting templates]]</noinclude>

Revision as of 20:21, 23 May 2013

MediaWiki has a few technical limitations, which are catalogued HERE. One of these restrictions is that the URL for an article cannot contain spaces. As a "smart" workaround for the fact that this would lead to articles with names like "Jimmy_Carter", the MW software automatically converts the underscores in the URL to spaces in such places as the title of the article at the top of the page. 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 can. Sometimes this is undesired behavior.

An example from our own wiki, look at the ai2_allpassive page. Ignoring that this is a redirect page, notice that the page title is displayed with a space in it, even though the underscore actually belongs there. This is purely an aesthetic concern, of course, but it definitely looks weird. To fix such a page, you would put {{Retitle|ai2_allpassive}} anywhere in the markup, and voila! your underscore is in its rightful place in the title.

Note that the abilities of this template are affected by the setting 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 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.