Sometimes wiki pages need to be moved from one wiki to another, or a large number of pages simply need to be copied from one wiki to another. The best way to do this is to export the pages from the source wiki and import them to the target wiki. This has the added advantage of preserving the edit history of the pages.
To export one or more pages from a wiki, go to the special "Export pages" page which is available on all wikis. Once there, you can either provide a list of pages or select your list from one or more categories.
The first field allows you to choose a category. Just fill in the name of the category in the field below "Add pages from category:" and click the Add button. The name entered in the field can contain the word "Category" or not. For example, both "Category:Community" and simply "Community" are valid entries.
Once you click the Add button, all pages and sub-categories in the chosen category will be added, one per line, to the larger box below. The contents of this second box can be edited manually. For example, you might want all the documents in the category, but none of the sub-categories to be exported. In that case, you would simply delete the lines with the names of the sub-categories. Alternatively, you might want just the sub-categories and none (or just a subset) of the pages. In this second instance, you would again just edit the contents of the box and remove the lines containing the pages (and categories) you wish to export.
If you want to include all the documents contained in the sub-categories listed, you can copy the sub-category names into the first field and click the Add button again. This can be repeated for as many other categories as you wish to include in your export. The categories can be sub-categories of the original category, or entirely different / unrelated categories. Simply click the Add button to keep populating your list.
- Tip: Sometimes you may end up with duplicates in your list. To avoid duplicates, you can copy the contents of the generated list to the software of your choice and sort the list and remove any duplicates. If you do not remove the duplicates, the duplicated page or category will simply be exported as many times as it appears on the list, which is inefficient, but not show-stopping.
Once you are satisfied that the list contains all the documents you want to export, you can then select any or all of the following options:
- Include only the current revision, not the full history
- This option truncates the page history leaving only the most recent revision.
- Include templates
- This option will additionally add any called Templates to the list of pages being exported.
- Save as file
- This is the only mandatory option if you later wish to import the selected pages elsewhere.
Once you have put checkmarks next to the options you wish to use, click the Export button at the bottom of the page. The name of the resulting file will be something like this:
and the file will be in your default browser downloads folder.
To import one or more pages from a wiki, go to the special "Import pages" page which is available to administrators on all wikis.
- The first field on the page (Filename:) can be filled by clicking the Browse button and selecting the XML file you wish to import.
- After that you can provide an interwiki prefix (this can be anything, but if the import is from a different language version of the same wiki, use that prefix. If the import is from an unrelated wiki, any string would do, but use something meaningful.) to the wiki from which you exported the page. It will be used in page history and will redirect to user pages of the authors.
- If the users exists on the local wiki, or if they are expected to exist soon, you can check "Assign edits to local users where the named user exists locally" box below. This will link to their user pages from the history page, and the edits will show up in their contributions.
- The next field is an optional comment which will be added to the import log.
- Then there are three options which can be selected:
- Import to default locations
- This is the default option which will import the pages and categories in the XML file to the same page names in the destination wiki.
- Import to a namespace: [select the target namespace]
- This option allows you to import all the pages in the XML file to a namespace other than the main namespace. Be careful using this option as it can have unintended consequences.
- Import as subpages of the following page: [specify the page name]
- This option allows you to import all the pages in the XML file as subpages of a single page. This will not work for categories.
- Import to default locations
Once you have determined which options you wish to use, click the Upload file button and wait.
Sometimes the number of pages in the import file is just too large and the import will time out. If this happens you can try to relaunch the import and sometimes it will finish after a second or third attempt. If it simply does not work, you may have to consider splitting the import file into smaller chunks.
Overwriting existing pages
The import process uses the date stamps on the existing and incoming pages to decide whether or not to overwrite a page. If the timestamp on the version of the page in the incoming XML file is more recent than the latest version of the existing page on the target wiki, the page on the target wiki will be overwritten by the version being imported. If the reverse is true, the version being imported will be ignored.
To force pages to be updated, you can edit the XML file and change the timestamps on the various documents, but beware, this can cause some strange results. For example, it is tempting to simply change the year to the current year, but if your imported pages were created in December and you are importing in June, they will show up as having been created "in the future".