Help:Shared templates

Template namespace
Templates on the Central Wikia can be used on any other Wikia by using.

One advantage of having shared templates on the Central Wikia is that they are watched by a large community, and can be quickly reverted in cases of vandalism.

List
See list of shared templates for a list of templates aimed at cross-wiki use, or Template:Homewiki for an example.

Updates
If a template is edited on the original Wikia, the idea is that pages update automatically after purging (by adding ?action=purge to the URL) but that may not (immediately) work.

You can "subst" a shared template using, for example,. When you save the page, the actual text of Template:GFDL will be saved on the page (hopefully the latest version, there may be purging problems here too), instead of the template being saved. If changes are later made to the template, these will not be reflected in the page. If you're worried about the template being vandalized or changed, or if you don't need the message to update later, use subst. Using subst causes less load on the servers than calling the template each time.

Usage and limitations
You can only include pages that are in the template namespace.

You must use the correct capitalization. will work, whereas  will not.

Links and variables in shared templates are interpreted as if put on a page in the central wikia, except when substituting the shared template. Thus, when the shared template is included in another wiki, an internal link in the shared template shows up in the style of an internal link, but linking to the central wikia, except when substituting the shared template, in which case the link is an internal link to a local page. A prefix which from the central wikia makes the link an interwiki link, may be a link to the project namespace from the other wiki, and conversely. See peize:Peize:Template sharing demo.

Editing and translating
Major changes that could have negative effects on other wikis should not be made to any templates here, especially ones on the list of shared templates. However, corrections and improvements that won't prevent the templates from functioning in the way they were originally used are welcome.

Translations are welcome, either at the native name for the template, or as a subpage of the English name, using lang code ]] format. For example, the Russian version of Template:Wikipedia could go at Template:Википедия or at Template:Wikipedia/ru.

Since these templates will be used on wikis with a wide variety of stylesheets in place, be careful not to add unnecessary styling and formatting to the templates, since this might conflict with the style of the wikis they are used on.

MediaWiki namespace
The Wikia navigation box in the sidebar makes use of shared messages in the MediaWiki namespace. This means the message is stored in the MediaWiki namespace on the Central Wikia and shared between all Wikia. Unlike other messages in that namespace, shared messages are only editable by admins on the central Wikia.

This feature is still in development, but may now be working for some of the links in the sidebar.

Shared links are added in GlobalSettings.php $wgWikiaNavLinks[] = array( 'text'=>'wikiahome', 'href'=>'wikiahome-url' ); $wgWikiaNavLinks[] = array( 'text'=>'shared-problemreport', 'href'=>'shared-problemreport-url' ); $wgWikiaNavLinks[] = array( 'text'=>'irc', 'href'=>'irc-url' );

If the message name looks like "shared-[title]", then the system will look for "[title]" in the Mediawiki namespace of the Central Wikia. If the default language of the Wikia (or the language set by a user in their preferences) is not English, then it will search for Mediawiki:[title]/langcode where langcode is the language code (see supported languages for a list of these). If nothing is found in the language specific subpage, it will use the English version.

For example, on the Chinese WikiMac, the "report a problem" link links to what's on MediaWiki:Problemreport/zh on the Central Wikia. Also, for users with Chinese in their preferences, and for non-logged in users, the link text is the MediaWiki:Problemreport-url/zh content.

This system allows the Wikia news box to be edited and translated from the Central Wikia.

zh:Help:共用樣板