Manual:Importing Wikipedia infoboxes tutorial
This page is currently a draft.
|
Note: This tutorial is not for novice users. Importing templates into your third-party wiki from Wikipedia is often times a lengthy and challenging process. Some of Wikipedia's templates require multiple layers of underlying "support" or "utility" templates. You may have to repeat the export/import process several times. The instructions have not had substantial updates since 2016, and much has changed since, so expect problems with these. |
This tutorial outlines steps to import infoboxes used by English Wikipedia.
Prerequisites
editBefore using this tutorial, you should familiarize yourself with the MediaWiki features it will be utilizing:
- Help:Export
- Help:Import
- Help:Editing pages
- Help:Templates
- Manual:Using content from Wikipedia
- Wikipedia infoboxes
- Designing infoboxes
You must also have these extensions installed, set up and working:
Preparation
editCSS
editEither manually create or Export/Import the CSS from the source wiki; e.g., https://en.wikipedia.org/wiki/MediaWiki:Common.css.
(this is optional; importing may be necessary to properly display some templates).
Note: This is required for most infobox templates, including the base infobox template itself. Use Ctrl+F to help you search.
JS
editEither manually create or Export/Import the JS from the source wiki; e.g., https://en.wikipedia.org/wiki/MediaWiki:Common.js.
(this is optional; importing may be necessary for some template functionality).
Extensions
editrequired
- Extension:ParserFunctions
- Extension:Scribunto
- Extension:Wikibase (some but not all templates need this)
- Extension:TemplateStyles
recommended
- Extension:InputBox
- Extension:TemplateData
- Extension:JsonConfig#Supporting_Wikimedia_templates - Some templates need this.
Commons Templates
editif copying templates from commons, either Special:Export/Special:Import these pages or create them manually in your local wiki:
Steps
editStep 1: Determine info boxes needed
edit- Find all infoboxes used on English Wikipedia at w:Category:Infobox templates
- If there's an info box being used in an article you'd like to import:
- Visit the page's edit screen
- Scroll to the bottom and find the appropriate page name for the infobox template you'd like to import
Step 2: Export Wikipedia templates
edit- Go to English Wikipedia's Special:Export page and enter the full page names of the infobox templates from step 1.
- For your first infobox to work, you'll also need to include the master infobox template,
Template:Infobox
- Be sure to check the Include templates checkbox to include other necessary templates
- Note that required templates may also include Scribunto modules in the module namespace
- Most templates put their documentation in a subpage, so you may want to include
/doc
subpage for each template you're importing- Example: for
Template:Infobox
you should also downloadTemplate:Infobox/doc
- Example: for
Step 3: Export Wikipedia Modules
editMany of the templates used in Wikipedia, especially the collapsible navigation templates, utilize Scribunto. Without these modules installed, the templates will produce Lua error messages. Please expand the list below of modules required for infoboxes that are needed.
The following is a list of at least some modules that you should export from English Wikipedia to an XML file. Just cut and paste this list into the list of files to be exported:
- w:Module:Citation
- w:Module:Hatnote
- w:Module:Unsubst
- w:Module:Sidebar
- w:Module:Message_box
- w:Module:Navbox
- w:Module:Arguments
- w:Module:Yesno
- w:Module:Authority_control
- w:Module:Infobox
- w:Module:Navbar
Step 4: Import infobox templates and Modules
edit- Go to your wiki's Special:Import page and select the file you created from the export in step 2.
- The modules you exported in step 3 will NOT import correctly unless you first have successfully installed Scribunto, which will create the namespace for "modules." After Scribunto is installed, the modules should import properly. Afterward, if you see templates that give a lua error message, try to identify the missing module that must be imported.
- Since many templates incorporate images, it is helpful to modify
LocalSettings.php
to allow instant commons import of images:$wgUseInstantCommons = true;
Step 5: De-Wikipediaify
edit- You may want to review all of the files that you just imported for references to Wikipedia pages.
- You can certainly leave them in place - and are encouraged to update them as links to the appropriate Wikipedia article (possibly using interwiki links)
- Pay special attention to categories, which may be buried in the template's code, and may include reference to Wikipedia
- Again, you can leave them, but you may wish to update them to your wiki's name or categorization policy
Step 6: Additional templates needed
edit- Once your import is complete, you should check the template on your wiki to see if it functions correctly
- A helpful step is to once again refer to the edit page's templates list
Step 7: Enjoy success
editThat's it! Enjoy your infoboxes!