The {{Selfref}} template adds a hatnote to a Wikipedia article that will not appear in any reuse of Wikipedia article content. In Wikipedia terminology, self-references in an article usually mention Wikipedia directly or tell readers to take an action that has to take place on Wikipedia, such as editing the article. Typically, self-references within Wikipedia articles to the Wikipedia project should be avoided. Reading such information off-site would only cause confusion.
With this template, you can safely make a self-reference where needed, but that need is rare. Before using this template, make sure the self-reference that you're thinking of adding doesn't fall into one of the types listed at Wikipedia:Self-references to avoid. Most other hatnote templates, such as {{for}} and {{about}} support a |selfref= parameter which may be more convenient to use.
To see this behavior, view a printable version of an article that has a self-reference hatnote, and notice how this template masks its content.
In most cases, {{Selfref}} is used to create a disambiguation link to a page in the "Wikipedia:" namespace from article-space; for instance, the page Objectivity (disambiguation) could have a self-referential "hatnote" link at the top: {{Selfref|For Wikipedia's policy on avoiding bias, see [[Wikipedia:Neutral point of view]].}}.
When using {{Selfref}} in this way, use the following format:
{{Selfref|The self-referential notice to display, including links.}}
which produces:
The self-referential notice to display, including links.
When using {{Selfref}} in this way, the text will be indented slightly, italicized (Wikipedia house style for self-referential notes), and both preceded and followed by a linebreak.
For inline (e.g. mid-sentence) use, without the indentation and line breaking, use {{Selfref inline}}:
{{Selfref inline|the self-referential text to display, including links}}
which produces:
the self-referential text to display, including links (illustrated here on the same line as other content).
Template {{Selfref}} also has the parameter |inline:
{{Selfref|the self-referential text to display, including links|inline}}
but it does not always function properly as of early 2019, and may cause a line break under some circumstances.
Unprintworthy content
Rarely, there is other, non-self-referential content which shouldn't appear in mirrors, print editions, or other off-Wikipedia reuses of Wikipedia content, and which shouldn't be italicized as a self-reference.
It is preferable to mark such unprintworthy content with the {{Unprintworthy inline}} template (which includes the noprint CSS class, but not the plainlinks class, since links in such content will not be internal self-references). Although not all mirror sites do so, the content in question can be removed by reusers of WP content, without any reformatting, by ignoring or removing content marked up by this template, or more accurately by the selfreference CSS class that it (and some other templates) use.
A deprecated, "brittle", legacy usage of {{Selfref}} has technically also been used for such unprintworthy cases, and pre-dates the {{Unprintworthy inline}} template. This is to simply end the template with a pipe character – |:
{{Selfref|the unprintworthy text to display without self-ref styling|}}
This method cannot be depended upon (for one thing, many editors will interpret the pipe as an error and remove it, turning the template into an indented self-ref hatnote!). This syntax has been obsolete since 2008, and any remaining uses of it should be replaced with {{Selfref inline}} (if real self-references) or {{Unprintworthy inline}} (if simply unprintworthy).
Example
Code
Page on Wikipedia
Page on [some] mirrors
{{Selfref|For the Wikipedia Sandbox, see [[WP:SAND]]}}
The Wikipedia Sandbox is a page on Wikipedia. {{Selfref|(You can edit it by clicking "edit" on the page.)|inline}} It has been edited many times.
{{srlink}}, for the opposite case when you want a link to the Wikipedia: namespace that does show in mirrors without breaking (for instance when writing an article about Wikipedia or something connected to it).
{{Printworthy selfref}} – for cases of self-references that are printworthy and may or may not be desired by reusers of WP content, depending upon whether they are mirroring or just using single articles
{{Unprintworthy inline}} – for unprintworthy inline material that isn't technically a self-reference