MultiBlog Template Tags

MultiBlog is a feature in Movable Type that allows content to be easily aggregated from multiple blogs or data sources within your Movable Type install to a single blog or page. The sources used for aggregating content can be configured through the Movable Type user interface via the MultiBlog settings area under the "Preferences > Plugins" area.

The sources can also be configured manually via your template code directly. A number of template tags support the blog_ids template tag attribute which is used for selecting the blogs across which to aggregate content. For example, the following template tag code sample will aggregate content across blogs with an ID of 1, 2 and 5:

<mt:Entries blog_ids="1,2,5">
   <p><mt:EntryTitle></p>
</mt:Entries>

The MultiBlog Template Tag

If you wish to set a context that includes multiple blogs that can span across multiple tags, one can use the <mt:Multiblog> template tag. This tag can encapsulate any number of tags that are "multiblog enabled" (see below) and will govern their respective scopes. For example, the following template tag code sample will output the last ten comments and entries for blogs with ids 1, 5 and 8.

<mt:MultiBlog include_blogs="1,5,8">
   <mt:Entries lastn="10">
      <p><mt:EntryTitle></p>
   </mt:Entries>
   <mt:Comments lastn="10">
      <p><mt:CommentBody></p>
   </mt:Entries>
</mt:MultiBlog>

Supported Attributes

  • blog_ids and include_blogs - a comma delimited list of blog ids to pull content from, or the word "all" which will result in all blogs that have not explicitly forbidden their content from being aggregated.
  • exclude_blogs - this tag assumes you want to pull content from all blogs except the ones specified by a comma delimited list of blog ids to NOT pull content from.

If none of these attributes are provided, then Movable Type will default to searching the current blog context only.

MultiBlog Enabled Template Tags

The following tags support this syntax:

  • mt:entries
  • mt:comments
  • mt:categories
  • mt:pings
  • mt:assets
  • mt:tags
  • mt:tagsearchlink
  • mt:tagrank
  • mt:authors
  • mt:blogs
  • mt:blogcategorycount
  • mt:blogentrycount
  • mt:blogcommentcount
  • mt:blogpingcount
This page was last updated on 2007-10-02, 10:34. [Edit]

10 Notes

For those looking to aggregate posts from more than one blog (say, a main blog and a "link blog" with id's 1 and 3 respectively for this example), here is the code I use for this that aggregates the posts, and allows you to use different layouts and css for the posts, depending on what blog they're from:

<mt:entries include_blogs="1,3">

<MTDateHeader> <!-- DateHeader Code --> </MTDateHeader>

<mt:SetVarBlock name="BlogID"><mt:BlogID></mt:SetVarBlock>

<mt:If name="BlogID" eq="1"> <div class="blogbody"> <!-- Chunk of Code for displaying entries from blog 1 --> </mt:If>

<mt:If name="BlogID" eq="3"> <div class="asideblogbody"> <!-- Chunk of Code for displaying entries from blog 3 --> </mt:If>

</mt:entries>

What about pulling all content from one blog and only specific content from another? Is this possible somehow? Right now I'm using invisible tags, but that means that even on the blog that I want to display all content, I have to put an invisible tag in the entries to get then to display. Is there an easier way?

@Jerame - Movable Type does not currently support that kind of advanced logic. But it might be possible to with the assistance of the MT Collate plugin.

@Byrne Reese - That's too bad. Collate doesn't appear updated for 4.x, but I'm not sure it will do exactly what I need.

What I want to do would look kinda like this:

The idea is that I can have 5, 10, 15 blogs (like localized versions for example) and if I wanted to display an entry from the main site, I could add a hidden tag to that entry and it would syndicate automatically. Or even the reverse would be great - having the localized blogs feed the main blog, like so:

...or something to that effect.

Something to think about for future versions. I would imagine it would be great for corporate bloggers as well. It would make cross posting and content sharing among many blogs infinitely easier.

You know, Mark just created a much simpler version of MT-Collate called more simply "Collate." It works with MT 4.1 - he has not created the documentation for it yet though. We should ping him and see what we can drum up!

Is there a way to display the posts by date, instead of having it display each blogs topics grouped.

I'm displaying posts from 4 blogs. When using the tags mentioned above, my post displays the post by the blog name & not by date (newest on first).

How can I correct that?

This is a follow-up to Solomon's comment (#1). While that code does style each individual entry, in some cases it might be useful to indicate style for all the same-date entries as a block. If this is what you want, the following code can help.


<mt:MultiBlog>
    <mt:Entries lastn="20" include_blogs="x,y" sort_order="descend">
    <mt:SetVarBlock name="BlogID"><mt:BlogID></mt:SetVarBlock>
    <MTDateHeader>
        <mt:If name="BlogID" eq="x"><div class="x"></mt:If>
        <mt:If name="BlogID" eq="y"><div class="y"></mt:If>
        <h2><$mt:EntryDate$></h2>
    </MTDateHeader>
        <$mt:Include module="Entry Body"$>
    <MTDateFooter>
        </div>
    </MTDateFooter>
    </mt:Entries>
</mt:MultiBlog>

This plugin is quiet great, but I can't find the written documentations to know which templates are supported, both for MT4 and MT5. With the latest version shipped with MT5, every Archive / WebPages templates are still not supported ? Only Main index ? Thank you for clearing the situation please

I've written a little article about how to integrate entries from multiple blogs in one date-ordered list: http://www.movabletips.com/2010/03/listing-entries-from-multiple-movable-type-blogs-sorted-by-date.html

This also works if you want to have entries from one category from one blog, and entries from another from a different blog, or with specific tags...

It works for MT4 and MT5 and no plugins are required.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.