Learning Movable Type: Combining Multiple Blogs Into One

There are several situations in which you might want to combine two or more blogs into one. You might want to create a "Portal" blog which displays the most recent entries or headlines of entries from various blogs. You might want to create a Sideblog or Linkblog (see tutorial). Or you might want to have what looks to be just one blog (such as Learning Movable Type) but is actually a combination of several.

The tools you have at your disposal are David Raynes' MultiBlog plugin, PHP Includes, SSI - Server Side Includes, and RSS, among others. This tutorial will focus on the easiest of these alternatives - how to use the MultiBlog plugin to combine blogs from a single installation of Movable Type.

Displaying Entries from Other Blogs

If you have several blogs on the same Movable Type installation, it is fairly easy to pull entries from one or more into another.

1. Install MultiBlog.
Download and install the MultiBlog plugin.

2. Adjust your Main Index Template.
Replace the MTEntries Tags (<MTEntries> and </MTEntries>) with <MTMultiBlogEntries include_blogs="1,2,3"> and </MTMultiBlogEntries>. In place of "1,2,3" pick the blog IDs of the blogs you wish to show. To find the blog ID, click on the blog name from the list of your blogs in your Movable Type edit window. The blog ID will appear in the URL bar of your browser, like so: http://www.yoursite.com/cgi-bin/mt.cgi?__mode=menu&blog_id=1. If you add a "lastn" attribute, for example, lastn="10", the list of entries will include the last 10 entries from all the blogs you selected combined.

3. Adjust the Rebuild Control.

(Click to enlarge.)

One very helpful feature of MultiBlog is that you can direct the indexes of one blog to be rebuilt when an entry from another blog is saved. For example, when I save a new entry in the LMT Announcements blog, the index templates for Learning Movable Type are rebuilt, so that the LMT Announcement entry shows up on the main page of Learning Movable Type.

To set this up, click on the MultiBlog link in the "Configure Active Plugins" section at the bottom of your Main Movable Type edit window.

4. Adjust MT Search Form
If you have an MT Search bar on the main page of the blog in which you are pulling in entries from other blogs, you might want to extend the search capabilities so that when your visitor performs a keyword search, the search is pulling from your other blogs as well. To do this, add the following lines to your search form code:

<input type="hidden" name="IncludeBlogs" value="1" />
<input type="hidden" name="IncludeBlogs" value="3" />

In this example, the search form would search blogs with the IDs 1 and 3. (See MT Keyword Search tutorial for more information on customizing MT Search.)

Using Multiple Blogs Seamlessly as One Blog

I have been asked several times how I set up the templates of the LMT Links and the LMT Announcements such that they behave differently than the other entries in Learning Movable Type. The answer is that they are separate blogs, which all look like one blog because of using MultiBlog and PHP includes. On Learning Movable Type, I have set up my Main Sidebar and the Individual Entry Sidebar as index templates, with .inc extensions, so I can use PHP to include them into the Main Index and Archive templates. (See Using PHP and MT Includes tutorial.) I have set up the Banner, the Navigation elements, and the Footer as separate Template modules, which I also use PHP to include into the Main Index and Archive templates of Learning Movable Type. In the LMT Links and LMT Announcements blogs, I simply use PHP to include the very same .inc files to create the sidebar, navigation, banner, and footer elements. I use MultiBlog to pull in the most recent announcement to the main page of Learning Movable Type. (See Keeping an Entry at the Top tutorial.)

Merging Your Blogs - at Movalog.

Posted by Elise Bauer on February 12, 2005 2:09 PM to Learning Movable Type http://www.learningmovabletype.com/