Jump to content

Wikipedia:FAQ/Template: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Reverted edits by 197.185.189.12 (talk) (AV)
 
(20 intermediate revisions by 19 users not shown)
Line 1: Line 1:
<noinclude>{{Wikipedia:FAQ/framework|shorttitle=Template|title=Template FAQ}}</noinclude>
<noinclude>{{Help contents back}}
Frequently asked questions about Wikipedia's templates.
{| width="100%" style="border: solid 2px #A3B1BF; background: #F5FAFF" |
|-
|
<h2 style="background-color:#cedff2; border-bottom:0px; border: 1px solid #a3b0bf; text-align:center; padding-top:4px;">Template FAQ
</h2> <!-- 3 line spacing of h2 is important for subsection edit links to work correctly, PLEASE DO NOT FIX --> </noinclude>
Frequently asked questions about the Wikipedia ''Template'' feature.

For a listing of existing templates, see [[Wikipedia:Template messages]].


==What are templates?==
==What are templates?==
Templates allow editors to implement functions. In their implementation, they are NOT limited to the Template: namespace. When you examine article source code, you can recognize them by double curly brackets. They can take parameters, both positional and named, and there are predefined keywords that are usually in capital letters.
:Templates are pages that allow editors to implement materials, repeated across many pages, with the same template. Templates are represented in [[Help:Wikitext|wikitext]] by open and closed double curly brackets (<code><nowiki>{{</nowiki></code> and <code><nowiki>}}</nowiki></code>). They usually take parameters in the form of <code><nowiki>|parameter=</nowiki></code>, which can change the display, the text, and so on of a template.

If you have some boilerplate text that you want to include in a lot of places, you might do well to make a template out of it. There are many existing templates that do useful and cool things, if you know how to use them. In the template and their corresponding pages, they are currently poorly documented, but there are few templates that are very complicated.

After that, it gets pretty complicated. For complete documentation, see [[m:Help:Template]].

==Categories==
Referencing Categories in a Template is tricky. Pay attention to the <nowiki> <include> and <noinclude> </nowiki> tags. Sometimes you want one, the other or neither. It depends on the semantics of the category and whether you wish for the template to show up in the category.

==Stub templates==
There are a wide variety of stub templates. There is some variety in style in how a stub template relates to its corresponding category. Commonalities in usage and style guidelines are emerging.

==Can templates be renamed, moved, redirected?==
Yes, but do your homework and pay attention to "What links here" (WLH). You may need to purge the cache for a page or touch pages that reference a template before WLH reports zero.

Of course, the best way to avoid having to rename a template is to give it an appropriate name to begin with.

==How do I delete a template?==
{{tl|tfd}}, but again, do your WLH homework. Note that deleting templates will probably break some history functionality. You should fix all the "What links here" down to zero before deleting a template.


----
[[Link title]]==What else are Templates used for?==


Templates are sometimes used to aggregate several small pages into one big page. An example of this would be pages acting as a log where, for editing purposes, there are per-day pages, but for viewing purposes, an aggregate of the entire week is desired.

==Why does my Template not take effect immediately?==
That one is a little complex.

Some aspects of templates do update immediately. For instance, if you change a template, and it has simple boilerplate text and if you visit the page that uses the template caller, the text is updated. That is, the appearance of the page has changed to reflect the new version of the template. The calling page has been "re-rendered".

In some cases (TBD), if you want the page rerendered, then you can "purge" the page to cause it to be re-rendered. The easiest way to do this on a one-time basis is to startup to edit the calling page, and then modify the URL in your browser to change the end of the URL from &amp;action=edit to &amp;action=purge and "visit" that URL. If you expect this to be a persistent problem, then you may have to add a purge link, such as:

<nowiki> <small>''[{{SERVER}}{{localurl:myarticle|action=purge}} Purge the cache]''</small></nowiki>

This is a common need in some "weekly" reports that are really an aggregate of "daily" reports.

If you have multiple levels of template calling, you make need to touch the intermediate templates to fully propagate the changes.

=== What links here ===

This gets even more complex.

If you actually modify the calling page and re-save it, then the "What links here" report will be updated. A special trick: If you save the save page w/o making any changes, the "What links here" report ''will'' be updated, but the save will not be recorded in your "My contributions" report. Again, no change is reported, but, as a side-effect, the dependencies get updated. The effect of this trick may be similar to that of a purge (TBD).


==What is that template with "stub" at the bottom of an article?==
A good example of a chronic lack of update is [[:Template:Opentask]]. This template has several lists of links, and they change frequently. Many old user talk pages (which were recently updated in a trivial way) link to this template and, if you look at [[Special:Wantedpages]], you will see that a cluster of "wanted pages" based on a recent state of the template. If any of the desired pages are discarded (like the "Votes for Willys" page was), then that entry, again, for instance the "Votes for Willys" entry on the "Wanted pages", will linger with a high reference count indefinitely. Again, this is due the user pages of dormant accounts, but if you ''visit'' those pages, you cannot ''see'' the dependency because the page ''is'' re-rendered.
:These are stub templates. They are used to place stubs into specific categories.
:[[WP:STUB|Stubs]] are very short articles that could do with some expanding.


==How do I rename or delete a template?==
Note that this page (this FAQ page) does not contribute to the problem because its reference begins with a colon (see page source) and so it does not render/inline the template here.
:Follow the instructions provided at {{section link|Wikipedia:Templates for discussion|Listing a template}}.


==Why did my template changes not take effect?==
The problem is that the action of simply saving a new version of a Template should not incur the overhead of updating all pages that call it. It may be that a software fix or a robot can update the references in a more timely fashion.
:The content of pages are cached. Purging the affected page(s) by adding <code>?action=purge</code> at the end of the URL will usually solve the problem.


==How do I report feature bugs?==
==How do I report feature bugs?==
Bugs should be reported to the [http://bugzilla.wikimedia.org/ MediaZilla] website. (See [[Wikipedia:Bug reports]] for instructions.)
:Bugs should be reported to [https://phabricator.wikimedia.org/ Wikimedia Phabricator]. (See [[Wikipedia:Bug reports]] for instructions.)


==How do I request feature enhancements?==
==How do I request features and enhancements?==
Enhancements can be requested at the [http://bugzilla.wikimedia.org/ MediaZilla] website. See also [[mw:MediaWiki roadmap]].
:Features and enhancements can be requested at [https://phabricator.wikimedia.org/ Wikimedia Phabricator].
<noinclude>
<noinclude>
|}</noinclude>
{{Wikipedia:FAQ/footer}}</noinclude>


[[Category:Wikipedia FAQ|Categorization FAQ]]
[[Category:Wikipedia FAQs|Categorization FAQ]]

Latest revision as of 14:40, 26 November 2024

Template FAQ

Frequently asked questions about Wikipedia's templates.

What are templates?

[edit]
Templates are pages that allow editors to implement materials, repeated across many pages, with the same template. Templates are represented in wikitext by open and closed double curly brackets ({{ and }}). They usually take parameters in the form of |parameter=, which can change the display, the text, and so on of a template.

What is that template with "stub" at the bottom of an article?

[edit]
These are stub templates. They are used to place stubs into specific categories.
Stubs are very short articles that could do with some expanding.

How do I rename or delete a template?

[edit]
Follow the instructions provided at Wikipedia:Templates for discussion § Listing a template.

Why did my template changes not take effect?

[edit]
The content of pages are cached. Purging the affected page(s) by adding ?action=purge at the end of the URL will usually solve the problem.

How do I report feature bugs?

[edit]
Bugs should be reported to Wikimedia Phabricator. (See Wikipedia:Bug reports for instructions.)

How do I request features and enhancements?

[edit]
Features and enhancements can be requested at Wikimedia Phabricator.



More FAQ topics