Where can I get templates for MediaWiki?
Asked Answered
S

3

22

I have noticed that a lot of mediawiki-based websites use such templates as Robelbox, Ambox etc. Where can I get them and how should they be installed?

Subulate answered 24/3, 2009 at 18:31 Comment(0)
H
26

It's a PITA and unfortunately (unlike extensions or media files) there is no repository of canned templates. Templates load other templates which load others in turn, etc.

Go to Wikipedia and copy the name of the template you're after, go to Special:Export and paste the name of the template in the big text box, e.g. Template:Infobox. Check "Include templates" and check "Include only the current revision, not the full history", (or the file will be too big). Click Export to dump a .xml file of the template. Then import this into the destination wiki.

After it has been imported open the template for editing, check the list below the edit box "Pages transcluded onto the current version of this page:". If there are any red links repeat the above steps for these templates as well. You might also need to copy styles in MediaWiki:Common.css page and Javascript in MediaWiki:Common.js before everything works. Finally edit the templates to customize for your wiki.

If it still doesn't work and you have messy pages of braces and if statements, then you need to install the ParserFunctions extension. If there is {{#invoke: }} in template code you'll also need to install the Scribunto extension.

MediaWiki Help:Templates explains the process in more detail.

Hitormiss answered 25/10, 2012 at 20:23 Comment(3)
+1 for mentioning it´s a PITA to work with templates.Danielledaniels
Following the above, I've just exported Template:Note from mediawiki.org. Why is the resulting XML file 8.8 mb? For a simple colorful box? Is that correct, or have I done something wrong?Bertram
I've edited the above from uncheck to check for "Include only the current revision, not the full history", otherwise the file will becomes far too large.Hitormiss
H
4

You can directly copy templates from Wikipedia. A nice example is the Keypress template.

Hungerford answered 25/6, 2010 at 21:1 Comment(0)
D
4

This task is a bit more involved than just exporting and importing.

A "simple" overview can be found here -> How to add Wikipedia templates to your own Mediawiki

  • Upgrade our MediaWiki to the latest stable version, hoping to match Wikipedia’s one.

  • Install the Scribunto extension and properly configure it.

  • Export/Import the LUA modules used by the (meta)templates you want to use and import them in your MediaWiki.

  • Export/Import the Wikipedia templates you want to use, together with all the required metatemplates, and import them in your
    MediaWiki.

  • Copy the relevant CSS classes from the Wikipedia’s Common.css file and paste them in your MediaWiki’s Common.css.

  • Activate MediaWiki IstantCommons feature to automatically fetch the Template image files from the commons.wikipedia.com repository.

Demonolatry answered 9/8, 2017 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.