User:Matsch/Integrating your wiki content in other websites

This short how-to explains how you can integrate your wiki content into other websites via iframes or something the like.

Another use case of this how-to is to have two different (looking) wikis with the same content.

Goal
Additionally to your normal wiki, make your hard-earned content available to other websites with an easy way of integration. Alternatively you can create two wikis that look different but have exactly the same content (e.g. different branding).

Approach
We will create a new (sub) domain for your wiki which will have a different default skin set. This skin will hide all navigation, edit, and add personal features of the wiki and will only show the content area.

Advantages of this approach:
 * Easy to integrate it into other websites using iframes or something similar.
 * The skin can be customized as desired.
 * Visitors to the normal wiki won't see any difference
 * No modifications of MediaWiki core are necessary.

1. Create New (Sub-)Domain
Create a new (sub) domain (e.g. ) pointing to the directory of your MediaWiki installation. Both your normal address and the new sub domain should point to the same location. This will enable us to distinguish your normal wiki from the external one.

2. Create a New Skin
If you just want to create a second wiki with same content but different skin you can skip this step and use whichever skin you want in step 3 (instead of ).

See Manual:Skinning for additional instructions on how to do MediaWiki skins.

 Use your current skin or the MonoBook skin as a base for creating a new external skin. Copy all associated files and directories to a new name (e.g. ).

Edit the file  and delete the parts not necessary anymore as described below.

This is what the current  looks like in MediaWiki 1.13.0 (partially):

For hiding the navigation, the tabs and the personal/user links you should delete everything from (including)

to (including)



You can now also customize the CSS file  (and all compatibility files like , if necessary):  Change the margins for the  area: 

Remove the border around the  area: 

Additionally you can hide the section edit links. Add the following at the end of your : 

Any further modifications you wish to make for the external version of your wiki content... </li>

</ol>

3. Change your
For your wiki to know which skin it should use, we will create a switch statement, which sets $wgDefaultSkin according to the requested domain name.

In your  replace

with

4. Enjoy!
You can now put http://external.yourwiki.com or any specific page of your wiki in an  element on another website.

Alternative Approaches

 * what about scary transclusion?
 * what about scary transclusion?