Template talk:Self-reference

Instructions for use
This template should be placed around any text in the main article namespace which is a self-reference (see Avoid self-references).

Why, you are asking, is such a trivial thing in a template? It is here to deal properly with self-references. In support of forks and mirrors, articles should never refer into category space, wikipedia space, or talk space.

However, occasionally there is a good reason to provide a "see also" link into such spaces. Currently the policy is that self-references are only allowed using a template. By using this template, you can include such a link in a way that allows a particular fork or mirror that doesn't copy these spaces to easily suppress that link. Mirrors and forks can choose to blank the template and suppress these references, or they can do a little bit of work and turn them into external references to Wikipedia. -- Jmabel | Talk 18:19, Feb 2, 2005 (UTC) (edited for clarity by Creidieki 18:39, 28 November 2005 (UTC))


 * I agree that this template is useful occasionally. However, potential users should be warned that just because a self-reference is placed in a template is not a license to include all the self-references you desire. They still create problems for paper versions of Wikipedia and are often not encyclopedic or professional. Use discretion. Deco 07:26, 5 Feb 2005 (UTC)

The only way I see this of any use is to make it very extensible. I am going to rename it to Template:Selfref (sr is undecipherably vague) and also change it to only accept a parameter, with no accompanying default text. To make use of it, you'd insert. -- Netoholic @ 17:54, 2005 Feb 7 (UTC)

TfD'd
This template was listed for deletion on Templates for Deletion. The decision was to keep this template. Please see Templates for deletion/Log for more information. If you are viewing this after April 2005, you will have to see TfD's history.

See also??
I can understand Category:Wikipedia maintenance, but what is the purpose of having a main and a See also section hidden within the template?—jiy (talk) 02:04, 7 November 2005 (UTC)
 * for easier navigation and thus a better wikipedia infrastructure -- Zondor 09:19, 7 November 2005 (UTC)

avoid self references mark
I made a change that adds a little mark to indicate it is a self reference and appears like this:

This is a self reference &lsaquo;sr&rsaquo;

Perhaps, its an eyesore but the point was to indicate this is a self-reference other than using pastel shaded information boxes. And as you know, self-references are not professional.

-- Zondor 09:19, 7 November 2005 (UTC)

Made another change that would appear like this:


 *  this is a self reference 

-- Zondor 18:35, 13 November 2005 (UTC)
 * Both have subsquently ceased to exist. --Wcquidditch | Talk 17:22, 23 November 2005 (UTC)

Adds extra space
This template seems to add extra space after the text in a way other dablink templates don't. For example, on the current version of Main, there is a gap between "For the Wikipedia main page, see Main Page" and "For the American state, see Maine." Anyone able to fix this?72.72.199.151 (talk) 22:31, 31 May 2008 (UTC)


 * I've changed the template in the following way:
 * I changed the normal version to use dablink, so should work like all the other hatnotes. This (I hope) will fix 72.'s concerns.
 * I changed the inline version to use the plainlinks and selfreference classes, just like the normal hatnote version.
 * I also changed the code to allow the inline version to be invoked with  in addition to  . --h2g2bob (talk) 22:23, 26 June 2008 (UTC)

Inline does not work in bulleted lists
I would like to add a selfref to a disambiguation page, but the template does not allow inclusion in a bulleted list.
 * Item 1
 * Item 2

- Even though there is an aserisk before the 3rd item, it does not show up as a bullet. Can someone fix this, or is there an alternative method? --George100 (talk) 07:10, 12 November 2008 (UTC)


 * This bug still occurs, in the sense that if you want to delete the entire bulleted item as follows you get strange formatting.


 * Item 1
 * Item 2


 * It would be best to eliminate the bullet as well as the item in the cleaned output. 14:13, 19 January 2016 (UTC)

Edit Protected
{{#switch:{{{2|NONE}}}

is causeing extra space on articles. Please change to

{{#switch:{{{2|NONE}}}

or

{{pp-semi-template|small=yes}} {{#switch:{{{2|NONE}}}

or

{{pp-semi-template|small=yes}} {{#switch:{{{2|NONE}}}

. Thank you.96.53.149.117 (talk) 02:04, 8 December 2008 (UTC)
 * {{Done}} Ruslik (talk) 14:52, 8 December 2008 (UTC)

Editprotected request involving this template
This message is to inform people monitoring this talk page that there is an "editprotected" request involving this and several other templates at Template talk:! cymru.lass (hit me up)⁄(background check) 20:36, 28 December 2010 (UTC)

Request to remove extraneous space
At the end of the page, there's additional spacing. If you could remove that (so as to remove an entirely unnecessary and empty line on all those articles), that would be most appreciated! Thanks. --Qwerty Binary (talk) 14:42, 11 August 2012 (UTC)
 * Hmm, there's no additional space. (If you copy all the source, into a notepad, you can check for yourself. The way that pagebreaks are highlighted in our edit-window makes it appear as if there is a superfluous space, but there is not.)
 * Which article(s) are you seeing problems in? (examples are always handy :) -- Quiddity (talk) 00:05, 12 August 2012 (UTC)

"Exclude in print" bug
does not inherit the print-exclusion code:

"... selfref normally uses Hatnote which has class="dablink" and that class is excluded in print by MediaWiki:Print.css. However, if the rarely used parameter is present in a selfref then Hatnote is not used and the selfref is not excluded in print. Spelling is an example of that (I had to examine around 50 selfrefs to find an example with inline)."

Posting this here; going to put this on my to-do list and attempt a fix after further investigation (if needed) later. meteor_sandwich_yum (talk) 04:24, 29 January 2014 (UTC)


 * I'm not sure uses with the inline parameter should be excluded from print. The quoted post was an explanation of the current situation and not an argument for changing it. I don't know how selfrefs with the inline parameter are generally used in practice. Maybe there are cases where we want inline selfrefs to be printed, and where users expect it. PrimeHunter (talk) 04:44, 29 January 2014 (UTC)


 * Agreed. After a lot of thinking, I've decided I'm not going to change this, for two reasons: 1.) I'm not confident enough to be sure I won't break functionality and 2.) after examining the first 50 namespace transclusions (I checked—Spelling does appear to be the only article-namespace page using it) I'm thinking it's not that big a deal.
 * Not to say it should never be changed, but just that it's too messy right now.
 * However, I will mention print-exclusion in the template documentation. The folks over at History of Wikipedia seem to be using Selfref incorrectly. I'm going to fix this. meteor_sandwich_yum (talk) 20:22, 1 February 2014 (UTC)


 * &rarr; {{sl|hastemplate:"selfref" insource:/\{\{ *[Ss]elfref *\{{!}}[^}]*inline/ prefix: :}} shows the nine six or so uses. I don't think self references should show in print, but then what does class="selfreferences" do? Wait for a mirror site to interpret it? So if I want to say something in article space, for online users, like search and navigation goodies, I recommend using nomirror, which does class="selfreference noprint".
 * International phonetic alphabet says.
 * Spelling says
 * Subscript and superscript says
 * Common sense (disambiguation) says Use common sense, Wikipedia namespace information page|inline}}
 * DIFF (a dab page) says
 * The others are false positives. &mdash; Cp i r al  Cpiral  08:13, 17 December 2015 (UTC)


 * "class=selfreference" marks what will be removed from mirror sites, per CharlotteWebb at wp:Village_pump_(proposals)/Archive_45. What is removed from a web site should be removed from print as well, right? &mdash;  Cp i r al  Cpiral  08:23, 17 December 2015 (UTC)

Should we warn against nested templates?
Nested templates (similar to those used in Multiple issues) of the same general location- & format-type can be made to work to some degree with Selfref, according to a few casual tests I ran at As of. However, I think the documentation should warn against it due to the resulting formatting errors:
 * Minor and subtile, and therefore more likely to be missed: Nesting another indented template inside the indented Selfref template indents the resulting line of text twice as far as is standard:


 * Major: Text within Selfref but before (outside) of the nested template will cause a line break, with the resulting text from the nested template indented twice as far:

Should we put a warning in or leave it out?

Also, what is the correct WP term for "a template that creates an indented, italicized line used at the top of an article or section"? Is that a hatnote template, or does the term "hatnote" include "message boxes used at the top of an article or section"? Hm. Maybe this distinction doesn't matter here, since something like Refimprove would be obviously ugly instead of subtly. Plus, if we caution against nesting any template, that would cover it. Still, I'm curious how robust our distinctions are, for the sake of clarity elsewhere.

Sorry all I can do is point this out, but my real-life limitations are getting in the way of doing this myself right now and I might not make it back here. Thanks in advance if you can discuss or work on this! — Geekdiva (talk) 22:17, 29 August 2015 (UTC)

You've discussed this template recently, so I'd like to point this out to you. Please see my post above. Thanks! — Geekdiva (talk) 22:25, 29 August 2015 (UTC)

Trim input
I think users should be free from the unnamed parameter space handling. It doesn't trim. I think we should trim space from any given input, so that the spacing output is determined naturally, by the spacing the template is given in the wikitext. &mdash; Cp i r al  Cpiral  00:33, 25 December 2015 (UTC)

Template-protected edit request on 10 April 2016
Add the  tags. I have saved the suggestion in the sandbox.

ADTCTalk Ctrb 10:06, 10 April 2016 (UTC)
 * The version in the sandbox you started from did not match the live template. There's a whole lot more there than just your request. Could you refresh the sandbox and have another go please? I'd do more but am not currently at my PC. Bazj (talk) 10:23, 10 April 2016 (UTC)

Template-protected edit request on 3 November 2018

 * The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Add  in this template per this discussion at the village pump. I don't think this edit would be controversial because the editors would not be affected by this edit. Thanks. Hddty. (talk) 11:28, 3 November 2018 (UTC)
 * Red information icon with gradient background.svg Not done: This is a pretty major change to how this template displays since doing this would hide it for most people, so there should be an explicit consensus in favour. Changes would also have to be made to Module:Hatnote since it also provides selfref functionality. Galobtter (pingó mió) 12:22, 3 November 2018 (UTC)

Should we make this template hidden in the article mainspace with a code to those who doesn't logged in, especially readers? The articles that linked using this template are mostly only in the interest of the editors and often distract the readers who come here only to read (example: Fair use, Internet troll, International Phonetic Alphabet). We already put links to the project page at the left bar and from the Main Page. Some would probably argue that this hatnote would attract new editors, however that's not our purpose, our purpose is to create an encyclopedia. Per Hatnote: "Their purpose is to help readers locate a different article if the one they are at is not the one they're looking for", most readers not even intended to look for the project namespace in the first place. This discussion is almost similar to WP:CNR. RfC relisted by Cunard (talk) at 06:33, 16 December 2018 (UTC). Hddty. (talk) 13:16, 3 November 2018 (UTC)
 * Why do you need another element? You can simply add the   class name to the existing   and   attributes. -- Red rose64 &#x1f339; (talk) 15:37, 3 November 2018 (UTC)
 * I don't know about the code but at least it's possible to do this. Hddty. (talk) 22:48, 3 November 2018 (UTC)


 * Comment. Add policies and guidelines category because this template is mentioned at WP:SELF. Hddty. (talk) 08:15, 12 November 2018 (UTC)
 * There seems to be some presumption on your part that there are no unregistered editors interested in the backspaces. This is patently untrue. --Izno (talk) 14:59, 12 November 2018 (UTC)
 * Oppose: unregistered users are just as important as registered ones. Most hatnotes serve only as a distraction to those who are at their target location already but that doesn't mean they're not necessary. — Bilorv(c)(talk) 12:52, 16 December 2018 (UTC)
 * Oppose. Fair use and International Phonetic Alphabet are precisely examples of the uses of the template where it is equally, if not more, helpful for unregistered users. Making the template (or any template) only visible to registered users can cause confusion among editors. The proposal seems to be basing on an unfounded assumption that unregistered users are less likely to be familiar with Wikipedia's policies and internal matters—when they can be just an experienced editor using a library computer. Nardog (talk) 16:17, 17 December 2018 (UTC)


 * The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Move discussion in progress
There is a move discussion in progress on Template talk:Self-reference which affects this page. Please participate on that page and not in this talk page section. Thank you. —RMCD bot 09:01, 28 October 2020 (UTC)