FA user icon.svg Angle down icon.svg User data
Name Teratornis/Template porting: theory and practice
Registered 2024

This is a user subpageW to document what I have learned about portingW templatesW from one MediaWiki wikiW to another.

Introduction[edit | edit source]

A templateW on Appropedia is a page that an Appropedia editor creates to include in other pages. Templates are handy for encapsulatingW wikitextW that would be tedious, error-prone, or distracting to type repeatedly on every page that needs it. The template feature of the MediaWiki software that powers Appropedia is vital to Appropedia's success, as it allows editors to maintain consistency, avoid duplicate effort, and extend Appropedia's underlying language to solve new problems as they arise.

PortingW means copying code from its native computer environment to a different environment, and adapting it to work there. When the source and destination environments are both wikis,W a synonym for "porting" is "transwikiing". However, as the word "transwikiing" is somewhat awkward, this document uses "porting" throughout.

Template porting typically means copying templates from Wikipedia (which has the world's largest stockpile of MediaWiki templates, by far) to a much smaller wiki, such as Appropedia. Wikipedia and Appropedia both run on the MediaWiki software, which helps with porting. However, MediaWiki is a highly flexible platform, and the implementations on the two wikis differ in many ways, which can prevent a template that runs on Wikipedia from easily running here. Template porting becomes a sometimes intricate game of overcoming these differences.

Eventually I may move this page or parts of it to the Project: (Appropedia:) namespace.

If you see anything on this page that looks like an attempt at humor, it is.[1] Comments, criticism, burnt offerings, etc. are welcome on the talk page.

Pre-requisites for readers[edit | edit source]

At a bare minimum, the reader should read wikipedia:Help:Template before reading this page. wikipedia:Help:A quick guide to templates is a better starting point for someone who has never heard of MediaWiki templates before.

In general, this page links to the definitions of jargon terms elsewhere whenever possible, rather than repeating all the definitions here. The MediaWiki software is one of best-documented systems yet invented by humans, which is not surprising since MediaWiki itself is possibly the best system yet invented by humans for collaborative document writing. Thus there is a lot I can link to, rather than rewrite.

Since this page is in English, references to "Wikipedia" will generally mean the English Wikipedia.W Template porting from other language Wikipedias to wikis in those languages will presumably be similar, but I have no experience with that so there may be some differences.

Motivation[edit | edit source]

Wikipedia is arguably the world's most successful wiki, and possibly the largest collaborative volunteer project in human history as of 2011. Wikipedia's self-imposed limits on content,W along with the Wikimedia Foundation'sW giveaway of the MediaWiki software, create a vast space for spin-off collaborations.[2] Appropedia falls within this space - we are a community of people who share an interest in sustainability and appropriate technology, and we wish to share our knowledge in ways not allowed on Wikipedia.

The MediaWiki Foundation gives away its MediaWiki software for free, but this is only a small piece of the collaborative editing environment enjoyed by Wikipedians. Wikipedia's enormous collection of templatesW constitutes another essential part. Unfortunately, identifying and porting a usable subset of Wikipedia's templates to another wiki requires much more labor than merely installing the MediaWiki software on a Web server. This page attempts to explain how to do that.

The following sections explore the reasons for Wikipedia's large template collection, and why a smaller wiki community on an outside project will want to port some of Wikipedia's templates. If you already know why you want to port some templates, skip ahead to #Taking notes.

The extensible language of massive collaboration[edit | edit source]

When Wikipedia began in 2001, not even the founders knew whether it would work, nor did they know how to recruit millions of volunteers from around the world to build the largest encyclopedia in history, and keep them working together more or less harmoniously.[3] However, the founders understood they needed a system with sufficient flexibility to evolve, as they went along, into the solution they could not have fully envisioned at the start.

Whenever humans collaborate on a task of any complexity for an extended time, they invariably develop their own specialized languageW to collaborate more efficiently. As they work out the structure of the task, they embed that structure in their language. This phenomenon is evident in virtually all vocations and avocations. Part of learning any new job or hobby that involves interacting with other practitioners is learning the jargon of that activity.

The language of Wikipedia includes several components: ordinary prose, technical jargon, and wikitext.W Wikitext is the markup languageW that Wikipedia's editors use to format pages. At its most simple, wikitext consists of a few basic markup codes that fit on a cheatsheet,W understandable to most novice editors in a few minutes. All wikis that run on the MediaWiki software share the same basic wikitext. Most people who have some domain knowledgeW to share can quickly see how to express it on a wiki, at least in a rudimentary way. This allows a wiki to accumulate raw content quickly.

However, a well-developed wiki is far more than a pile of raw text. It is also a system for presenting information in an orderly way to readers, and for coordinating the efforts of editors so they avoid duplication and conflict. Templates constitute a remarkably capable tool to allow ordinary (unprivileged)W editors to extend[4] wikitext to more efficiently solve a vast array of process and presentation problems. Wikitext, in combination with templates, has some features of a programming language,W which wiki editors can use to automate repetitive tasks, reduce the uncertainty which leads to conflicts, and improve the presentation for readers.

A wiki with a rich selection of templates is able to reduce much content writing to almost an algorithm,W i.e. a procedure anyone can follow without having to think about the mechanics more than necessary. For example, consider infoboxesW on Wikipedia. When an editor starts a new article on a topic, if an infobox is already available for the topic area, the editor can simply begin filling out the infobox fields. This is much easier than starting a completely blank page and having to invent the topic structure from scratch. Structured information entry is less prone to conflicts, because editors only have to hash out what should go in the infobox one time, and thereafter they can apply it to potentially hundreds of articles without having to repeat the debate every time.

Templates and stigmergy[edit | edit source]

Templates play a role in creating stigmergyW on a wiki, the "stimulation of workers by the performance they have achieved." Editors on a wiki can observe the edits of other editors who use templates to save effort and improve presentation, and then apply those templates or other templates to new sitations. Adding a useful template to Appropedia and showing it to other editors by using it can be similar to a termite which drops a pheromoneW-laced mudball on the growing termite mound, and in so doing attracts other termites to add their fragrant mudballs to it. One way to make our "mudballs" more "fragrant" is to always leave informative edit summariesW containing linksW to the templates we use. That makes it easy for other editors to examine Recent changes or a page's historyW and navigate to the template pages where they can read the documentation.W

Quality of presentation[edit | edit source]

A large part of Wikipedia's popularity is the quality and consistency of its presentation. Well-developedW Wikipedia articles look good on a computer screen, and they present information in an orderly and pleasing way. The layoutW organizes essential information for fast access - after you read a few Wikipedia articles, you know where to find information when you look at an article you have not seen before. Part of the presentation quality is due to templates, such as infoboxes,W message boxes,W and navigation boxes.W A small wiki which lacks these templates will have a more barren, plain-text appearance,[5] which doesn't look as good, and makes it harder for readers to extract essential information quickly.

Porting article content[edit | edit source]

Wikipedia is one of the world's largest troves of free content. Almost every non-Wikipedia wiki will overlap Wikipedia's content somewhere. Thus it is useful to copy some articlesW and other pages from Wikipedia to a smaller wiki.

Unfortunately, the high-quality Wikipedia articles that editors will want to port tend to use a lot of templates. When these templates are absent on the destination wiki, the result is an unattractive, discouraging mess of red links.W What seemed to be just a simple page copy expands into a major technical project. Special:WantedTemplates provides a (sometimes horrifying) snapshot of this process on a given wiki. Many if not most of the wanted templates are on pages that editors copied from Wikipedia.

Since editors will inevitably copy articles and other pages from Wikipedia, having a comprehensive set of templates already installed helps provide a positive editing experience. The relatively fewW editors who have learned how to port templates should therefore try hard to port all the wanted templates. They can be like a force multiplierW for all the other editors.

Analogy to appropriate technology[edit | edit source]

"Appropriate technology (AT) is technology that is designed with special consideration to the environmental, ethical, cultural, social, political, and economical aspects of the community it is intended for."W Beyond the somewhat fancy words, in practice this often means coming up with something that works in a country that is far less technologically developed than the native countries of the folks who invent the technology. In the developed countries, people get used to having all sorts of infrastructure, facilities, conveniences, trained workers, etc. readily available, which are often not available in more rustic settings. There is an analogy with going on a camping trip, which usually involves leaving behind some or all modern amenities.

In the world of wikis, Wikipedia is like the most developed country in the world. For someone used to editing on Wikipedia, going to a small wiki can feel like leaving London in 1650 and sailing to the New World. When European colonists headed to the Americas, they could not take everything with them. They had to work out the minimal set of technology they could fit into a sailing ship, which would let them survive when they reached the destination, often with no firm idea of when the next supply ship might arrive.

For the Wikipedia expatriatesW working on a small wiki, a first step in building a comfortable editing environment is to bring along some templates. Fortunately the problem is easier than what confronted the colonists, because there is no geographic barrier preventing access to Wikipedia. It's straightforward to keep going back to grab more goodies for the small wiki.

For my fellow Wikipedia expats, my advice is to make your editing environment on Appropedia as comfortable as you can. The more Wikipedia-like features you build here for your own use, the more welcoming you make the site for other Wikipedia editors who venture here. If you expect to see a particular template here, odds are some other people will too. Editors who have previous experience on Wikipedia are particularly valuable to recruit as editors on a small wiki, because they already know a lot about how to collaborate on a wiki. A new wiki filled with only new users re-inventing wiki know-how from scratch can be a chaotic place, so anything that attracts editors with prior Wikipedia experience is probably a good thing.

How to spot a serious wiki[edit | edit source]

When you visit a MediaWiki-based wiki for the first time, a quick way to gauge its level of development is to look at Special:PrefixIndex/Template: and Special:WantedTemplates. On a well-developed wiki, the former page will be teeming with templates, while the second will be empty or at least manageable. Those pages, along with the age of a wiki, might predict whether the wiki will fail.[6]

Taking notes[edit | edit source]

Now that we know some reasons why someone might want to port templates to Appropedia, we can focus on how.

My first piece of advice is to take notes on what you are doing. Template porting often becomes too complex to finish in one sitting, so you may need to come back for days on end to finish a complex porting job. You may lose interest for days or weeks, and when you come back, you might not remember what you did. Template porting will almost certainly impact other users on a wiki, so it is courteous to explain your actions in writing to let others understand what you did, at any time in the future. In the worst case, if you cause a serious problem, you or someone else may have to unwind some of your actions. Figuring out what happened will be much easier if you keep good notes.

As an example, I humbly submit User:Teratornis/Tasks. It may not represent best practice, but it is better than no notes at all, and it illustrates some useful features of a notes page on a wiki. By red-linkingW all the templates, categories, and other pages I intend to make, I can visually track my progress by watching the red links turn blue one by one (as I create the pages they link to). Marking sections as done (with a simple Done!) provides an additional visual clue for easy scanning.

Since Appropedia helpfully leaves page view counters enabled, you can see how many other wiki users are looking at your notes. This gives some idea of how relevant (or perhaps disruptive) other editors find your work.

Transwiki guide[edit | edit source]

Some templates on Wikipedia have Transwiki guides that contain notes about how to port them to other wikis. Such notes may be sketchy but they are better than nothing. If you learn anything useful in the course of porting a template, you can help other users by editing the transwiki guide to share what ou learned.

See:

As of 12:37, 25 August 2012 (PDT) this feature is quite rudimentary, with only some limited notes for a couple of templates. But at least someone on Wikipedia is thinking about your problem.

Dependencies[edit | edit source]

Template porting ultimately boils down to copying a lot of stuff: the text of the template page itself, and lots of other stuff that the template uses. The other stuff we call dependencies.W Unfortunately (and this is truly unfortunate), MediaWiki has no feature that lets you easily list all the dependencies of a given template. If MediaWiki had such a feature, perhaps combined with an Export button to package all the dependencies into one convenient file which you could import on another MediaWiki wiki, then template porting would almost be simple enough for a monkey to do. The lack of this feature means that sometimes template porting can be hard enough to defeat trained computer professionals.[7]

Since template porting is a considerable technical barrier to re-using Wikipedia's content in a convenient way, one might suppose the folks who run Wikipedia might want to make it easier, since fostering re-use is a stated aim of the Wikimedia Foundation.W All in due time,W I suppose. Perhaps part of the problem is that a lot of Wikipedians don't edit much on other non-Wikimedia Foundation wikis. The more you edit on a particular wiki, the more you probably want to keep editing there. Another part is probably that writing good tools for template porting is really hard. When a job is hard to do manually, due to all the gotchas and exceptional cases, it's often many times harder to automate.

The following sections list all the kinds of template dependencies I have run across, and how to analyze them.

MediaWiki version[edit | edit source]

The MediaWiki software constantly evolves, with a major revision coming out at least once per year. Wikipedia always runs a newer developmental revisionW than is available to the rest of the world. New revisions of MediaWiki may add new features. If a template on Wikipedia uses a feature of MediaWiki that isn't in the version of MediaWiki your wiki is running, the template probably won't work on your wiki.

Compare Special:Version on your wiki to wikipedia:Special:Version. If your wiki's MediaWiki version is getting too far behind Wikipedia's, it's time to pressure your administrators to upgrade.

If you suspect a version discrepancy is hampering a template port, look at the historyW of the template on the source wiki. You may be able to port an old revision of the template to your wiki, which had to be able to run on an older revision of MediaWiki. The Wikipedia of two or three years ago was pretty good, so maybe you don't need the absolute latest.

MediaWiki extensions[edit | edit source]

A template may use wikitext tags, magic words,W parser functions, or other language elements that are not present in bare-bones MediaWiki. Special:Version lists the installed extensions on a MediaWiki wiki. Compare those pages on the source and destination wiki to see what you are up against.

The destination wiki may need more MediaWiki extensions to run a given template. For example, most complex templates on Wikipedia use parser functions, especially templates that have optional input parameters. This includes most infoboxes, navigation boxes, basically everything you need to build a credible wiki. Fortunately, Appropedia has parser functions installed now.

A template may use features of a MediaWiki extension only available in the latest revision of the extension. If you need the latest revision of an extension, it might not be compatible with an older revision of MediaWiki. Resolving such version problems can be hard, and will require help from the administrators of your wiki. Again, you may be able to work around such problems by porting from an old revision of the template on the source wiki.

If a template tries to use a missing extension, the visible symptoms may include tag bleed-through. I.e., the rendered page that transcludesW the template may show some raw template codes that the MediaWiki software has not processed. You may also see the template behaving strangely.

Template dependencies[edit | edit source]

Templates may use (i.e., transcludeW) other templates. This is by far the easiest template dependency to resolve, because it's the only one MediaWiki directly reports. Click the "edit" tab on the template page on the source wiki[8] (which will be a "view" tab if the template is protectedW), click "Show preview",W and scroll to the bottom of the page to the "Templates used in this preview:" list. The list is recursive;W it shows all the templates used by the current template, the templates used by those templates, and so on. You can copy this list and edit it into your page of notes.

Many templates on Wikipedia have large numbers of template dependencies. The first step in template porting is to determine which templates you really need. Some of them are incidental templates, only applicable on Wikipedia. For example, Template:Pp-templateW is a graphical template that shows when a template is protected on Wikipedia. Unless the destination wiki has the same protection policyW as Wikipedia (which is unlikely), you probably don't need that template.

Other template dependencies provide core functionality; some of these have the word "core" in their names. For example, {{Citation/core}} provides code to other citation templatesW such as {{Cite web}} and {{Cite book}}.

When a template on Wikipedia has a large number of template dependencies, you may be tempted to edit a cut-down version of the template that does not use the dependencies. This is acceptable if you expect or want your wiki to stay small. For your wiki to grow, it must have the necessary properties for growth. One of those properties is a high degree of abstraction.W Wikipedia, being one of the largest wikis, takes abstraction to a fantastic degree, with many common template functions abstracted out to sub-templates. Many if not most of the features you see on Wikipedia are there because they are necessary (or at least helpful) to a top-ten Web site. If you want your wiki to grow, presumably it should emulate the wiki that grew the most.

Simplifying Wikipedia's templates for one-off template ports might save time in the short run, but in the long run it creates friction on your wiki in several ways:

  • If your wiki accumulates many templates that do not follow Wikipedia's abstraction style, skipping the template dependencies, it never gets easier to port additional templates that have the same template dependencies. Instead the next template port requires similar editing work to make a cut-down version, or else someone will finally have to port the dependencies.
  • Having templates that look like Wikipedia's templates, but don't have the same internal structure, creates distraction and uncertainty for other editors. When they look at existing templates to understand the prevailing style on a wiki, they are left to wonder whether they should follow Wikipedia's style.
  • Wikipedia constantly evolves, eventually creating pressure for other wikis to keep up. Templates that follow Wikipedia's style are easier to update from Wikipedia. In contrast, templates that required editing during the initial port will require similar editing during updates.

Among the first dependencies to resolve are the documentation templates.W This can seem like unnecessary overhead on a (currently) small wiki, but most newer Wikipedia templates use them, so template porting becomes easier once the documentation templates are in place. Therefore, those were among the first templates I ported to Appropedia when I started porting templates here. Documentation templates have advantages beyond simply staying compatible with Wikipedia. Separating the documentation for a template onto a subpage makes both the template and the documentation easier and safer to edit, particularly for templates with lengthy code and documentation. There is less chance of "blowing up" a template by making a mistake on its documentation section, which is a risk when both are on the same page. For templates that many pages use, the risk is not trivial. Performance might also be slightly better with separate documentation subpages, because the MediaWiki parser does not have to scan through all the documentation on each template transclusion.W Separating the documentation lets you protect a high-risk template while still allowing everyone to edit the documentation.

CSS classes[edit | edit source]

Some templates use CSSW classes that they expect to get from MediaWiki:Common.css. To see the styles a template wants to use (which may include additional styles in the templates the template uses), examine the template code for things like this:

<div class="reflist references-small " style="">

Then press Template:Key press or Template:Key press in your Web browserW to search the MediaWiki:Common.css page on the source wikiW for the class names you found in the template. If the corresponding CSS code chunks are not in the local MediaWiki:Common.css, you will need an administrator to copy them for you.

If a template has a lot of template dependencies which may also be using CSS classes, you might be able analyze them faster with wikipedia:Special:ExpandTemplates. Copy and paste a sample usage of the template into that page, and it will show you the resulting wikitext after the MediaWiki parser substitutes all the template dependencies, executes all the parser functions, etc.

The simplest solution might be to copy the entire contents of wikipedia:MediaWiki:Common.css into the local wiki's MediaWiki:Common.css page. Copying more CSS classes than you need doesn't seem to hurt anything, so when in doubt about a particular class, just copy it.

Everything on Wikipedia constantly changes, so periodically the local copy will need updating.

JavaScript[edit | edit source]

Some templates require JavaScript code from MediaWiki:Common.js. As with CSS classes, this is a matter of finding the chunk from wikipedia:MediaWiki:Common.js and copying it to the local page.

Since JavaScript dependency is not too common, a template's documentation should mention it. Since Wikipedia works in browsers that have JavaScript disabled, the lack of some JavaScript code will usually not be fatal to a template. Instead there might be some feature that doesn't work (such as the show/hide links in {{Navbox}} templates).

Other external software[edit | edit source]

Some Wikipedia templates have rather perverse dependencies on additional software that runs on Wikipedia's servers, but probably not on your wiki's server. An example is the {{Navbox}} template, whose canonical Wikipedia version requires HTML Tidy.W Installing the software on your server is probably not an option in the short term, since only the most privileged site administrators could do it, they might not be able to do it for various technical reasons, and they are always the most busy people so they cannot do it quickly in any case.

However, all is not lost. Thousands of other MediaWiki wikis have the same problem, so if the perverse template you want to port is at all popular, someone may have written a portable version of it. One place to find such templates is wikipedia:Wikipedia:WikiProject Transwiki#Special templates.

Figuring out when you have copied a perverse template is a bit harder. These templates don't usually announce themselves. Instead they just refuse to work correctly on the destination wiki. Unless you are a template coding expert, you probably cannot solve this problem by yourself. You are at the mercy of someone in the larger wiki community to write a portable version and make it available so you can find it.

One common source of these porting problems is a peculiarity of wikitext syntax: the use of the pipe characterW as a delimiterW in both parser functions and in wikitext tables.W This makes it impossible to put raw wikitext table code inside a parser function, for example to conditionally display some portion of a table within a {{#switch:...}} statement. There are two common workarounds in Wikipedia templates to this wikitext syntax conflict with the pipe character:

  • Use HTML table codeW instead of wikitext table code within the parser function. This only works on wikis that are running HTML Tidy like Wikipedia does. If HTML Tidy is not installed, the MediaWiki parser quotes the HTML table codes, so they display as raw codes instead of as tables.
  • Encode the pipe characters in the wikitext table code with the {{!}} template. This is the more portable solution.

See wikipedia:Wikipedia:Conditional tables.

For example, wikipedia:Template:Information contains this non-portable excerpt with HTML table code:

{{#switch: {{{Other_versions| {{{other_versions| {{{other versions|}}} }}} }}}
|   = 
| - = 
| none = 
| #default = 
<tr valign="top">
<th style="background: #ccf; text-align: right; padding-right: 0.4em;" id="fileinfotpl_ver"> Other versions </th>
<td> {{{Other_versions| {{{other_versions| {{{other versions|}}} }}} }}} </td>
</tr>
}}

The purpose of this code is to put the "Other versions" row of the image information table into a {{#switch:...}} statement, to display the row conditionally. To make a portable version of the template ({{Information}}), replace the HTML table code with wikitext table code that uses {{!}} to encode the table pipe characters:

{{#switch: {{{Other_versions| {{{other_versions| {{{other versions|}}} }}} }}}
|   = 
| - = 
| none = 
| #default = 
{{!}}- valign="top"
! style="background: #ccf; text-align: right; padding-right: 0.4em;" id="fileinfotpl_ver" {{!}} Other versions
{{!}} {{{Other_versions| {{{other_versions| {{{other versions|}}} }}} }}} 
{{!}}
}}

The ! table code characters are fine to include literally, as are the pipe characters that are part of the template code itself. Only the pipe characters that are part of the table syntax need to be encoded.

The non-portable Template:Navbox may work here[edit | edit source]

13:54, 25 May 2011 (PDT): User:RichardF copied the latest "non-portable" version of wikipedia:Template:Navbox to {{Navbox}}, to enable newer features such as child navboxes and groups. Despite containing HTML table code inside of parser functions, the "non-portable" template seems to work on Appropedia. I should investigate why the template is not breaking here as I would have expected. See:

Categories[edit | edit source]

Virtually all templates on Wikipedia use at least one category,W for various things:

  • to categorize the template itselfW
  • to categorize the template's documentation subpageW
  • to categorize pages that transcludeW the template

It's nice to create the same categories, or counterpart categories, on the destination wiki. Otherwise the templates you port will create more red links for Special:WantedCategories, which is not the best wiki etiquette. Creating red links for other editors to clean up can be considered a bit rude, unless you are a new user and no one expects you to have learned how to clean up after yourself yet. Categories are often one of the most confusing MediaWiki features for new users, which is one reason why the category structure on a small wiki tends to be messy.

When you create new categories, you should also categorize them, and so on until they fit into the existing Appropedia category structure. As the category structure on Appropedia does not exactly follow Wikipedia's category structure, this may require some thought.

To-do: explain how to do this.

Debugging[edit | edit source]

If you port templates from Wikipedia to Appropedia, you will probably have some problems. This section gives hints about how to debug them.

  • Note that there is no debuggerW for MediaWiki's template feature. This is a troubling deficiency because the more complex templates can contain code that is as difficult for humans to read as any programming language. Few professional software developers would want to code in a system that lacks a debugger.

Special:ExpandTemplates[edit | edit source]

One problem with templates is that you can't easily see what they are doing, except by looking at the rendered page. If nothing renders at all where you expect your template to do something, that is not informative. There is a MediaWiki extension called ExpandTemplates installed on Wikipedia. You can paste some template code into wikipedia:Special:ExpandTemplates, to reduce it to wikitext, which is usually a lot easier to read than the original template code.

Searching the Web for other successful ports[edit | edit source]

If you edit on a MediaWiki wiki, you are far from alone. Thousands of other similar wikis exist, with lots of people trying to port templates from Wikipedia. Try searching the Web with {{Google}} for quoted phrases from your template's documentation page. That makes it easy to find verbatim copies of the template on potentially many other wikis. You may find other instances of the template with the same problem you are seeing. If you can find one that works, that gives you another point of reference to compare with your wiki. It may be easier to find the differences that matter by comparing pages like Special:Version and MediaWiki:Common.css on your wiki to the corresponding pages on another small wiki where the template works.

For example, if someone ported the {{Reflist}}W template from Wikipedia, and its documentation subpage, their copy may show up with the following search for the template name, and a specific phrase that appeared in the documentation in early 2011:

The top search resultsW will usually be to instances of the template on Wikipedia and other Wikimedia Foundation wikis. Scroll down a few entries to find the non-Wikimedia Foundation wikis, and see whether their porting attempts succeeded.

Ask a human for help[edit | edit source]

It's good to be self-reliant but if a stubborn template brings you to your knees you won't have been the first. Read the template's talk pageW and its archived pages on Wikipedia, where users may have discussed porting the template to outside wikis. You can ask for help on wikipedia:Wikipedia talk:WikiProject Transwiki. Your local wiki experts might be able to help. You may find someone who can help on another non-Wikimedia wiki where the template works. No matter where you ask, always ask the smart way.[9]

Testing on an offline wiki[edit | edit source]

You can set up your own offline personal wikiW that runs on MediaWiki by following the instructions in mw:Manual:Wiki on a stick. This can be vital for testing your template ports if you have problems porting to the target wiki, especially if you lack administrator privilegeW there.

Setting up a personal wiki lets you study the inner workings of MediaWiki, including factors that impact templates, more efficiently than you can as an ordinary unprivileged user on a public wiki. You can also test changes that may be potentially dangerous, with no risk to the public wiki.

Tidying up and customizing[edit | edit source]

A template may contain details that require editing on the destination wiki. For example, wikilinksW in the template or its documentation may become red links on the destination wiki. Usually you can fix these by inserting a wikipedia: interwikiW link prefix, to restore the link to the page on Wikipedia. On template documentation pages, you can also use the {{W}} template to display a compact superscripted link. If you want to create local copies of the pages so you can keep the links local, that will of course require more work.

Attribution[edit | edit source]

When you copy a template from a wiki such as Wikipedia, you must comply with the licensing requirements on the source wiki. See for example: wikipedia:Wikipedia:Reusing content. On Appropedia we meet these requirements by displaying the {{Attrib wikipedia}} (alias: {{From Wikipedia}}) template at the bottom of the template documentation.

The good news[edit | edit source]

One of the few glimmers of hope in the arduous realm of template porting is that the more templates you port, the easier it becomes to port more templates. That's because many templates on Wikipedia share many of the same dependencies. If you bite the bullet early, and port all the dependencies you need for some templates, rather than editing the templates down so they don't need the dependencies, you will build up a critical mass of things that many templates depend on. A relatively small numberW of people write many of the templates on Wikipedia, and they tend to use the same bag of tricks over and over. The more templates you have ported from Wikipedia, the more likely you are to have more of the dependencies you need for the next template you want to port.

See also[edit | edit source]

Notes and references[edit | edit source]

  1. An attempt, that is. For some reason, my attempts at humor tend to elicit comments like "Don't quit your day job."
  2. See WikiIndex for a partial listing of other wikis, many of which started after Wikipedia and were inspired by it.
  3. I say "more or less harmoniously" because within Wikipedia's vast flow of editing activity, there are always dozens of content disputes going on. Wikipedia has developed a complex sub-industry for resolving its disputes.W
  4. Extending the syntax of wikitext with templates is distinct from MediaWiki extensions,W which provide more powerful extensibility to the MediaWiki software via PHPW code. This is a deeper component of the language of a wiki, visible only to users with sufficiently high privileges.
  5. Rather like this page, although the notes and references are looking a little better since I ported the Wikipedia version of {{Reflist}} here.
  6. This is purely speculative, but it seems plausible. A wiki with a lot of users who port and write templates probably has the skill base to overcome the other problems that destroy wikis. Having lots of templates may also improve presentation, which attracts more readers, and thus more contributors.
  7. Even the computer professionals who are smarter than monkeys.
  8. On the destination wiki, MediaWiki will only display the template dependencies it can see. For example, if you have only copied the template you want, you can only see the names of templates it directly transcludes. The templates those templates transclude will not be visible on the destination wiki until you copy those templates, and so on. Thus to get the list of template dependencies, you should view the source of the template on the source wiki first.
  9. Raymond, Eric Steven; Moen, Rick (2006). "How To Ask Questions The Smart Way". Retrieved 2011-01-28.

External links[edit | edit source]

Cookies help us deliver our services. By using our services, you agree to our use of cookies.