Hacks : Rebuild Entry 2.0 Mar 05 2003 | # | C:2

Rebuild Entry 2.0

March 5, 2003 - updated February 8, 2006

The Edit Entry page in MovableType allows you to Preview, Save and Delete and entry, but it does not allow you to Rebuild an entry without saving it first. Similarly, when you modify some attribute related to an entry (such as comments, trackbacks or pings) there is not easy way to just rebuild the entry. Why would you do you need to rebuild an entry? When you delete or edit an entry’s comment, the entry must be rebuilt in order for your site to reflect the change (comments listed by the mt-commenst.cgi are always up to date, even without rebuilding). However, rebuilding the entire site just because a comment was changed is a bit of an overkill. The easiest way to rebuild just an entry and corresponding indices and archives is to simple Save the entry - even though nothing in the entry has changed. When you save an entry, Movable type automatically rebuilds all the pages that might be affected by it. The problem with this approach is that saving an entry updates it’s modifed_on date which is used in MTEntries listings and in plugins, such as Kevin Shay’s LastModified. The following hack modified the Edit Template page by adding a “Rebuild” button. You can use this button to rebuild the entry without changing its modified_on date. The hack also changes the “Rebuild” link that you see after you modify comments, etc. to only rebuild the entry and associated indices and archives.


  1. Open the edit_entry.tmpl file in the tmpl/cms directory in your MovableType installation.
  2. Declare a JavaScript function that causes the current entry to be rebuilt
    Find the section that says:
    <script language="JavaScript">
    and insert the following code after it:
    function doRebuildEntry () {
       window.location = '<TMPL_VAR NAME=SCRIPT_URL>?__mode=start_rebuild&blog_id=<TMPL_VAR NAME=BLOG_ID>&next=0&type=entry-<TMPL_VAR NAME=ID>&entry_id=<TMPL_VAR NAME=ID>&old_status=2';
  3. Change the “Rebuild” link to rebuild entry only
    Find the line that says:
    function doRebuild () {
    and insert the following line after it:
        return doRebuildEntry ();
  4. Add a “Rebuild” button for the top of the page
    Find the line that says:
    	<input class="button-big" onClick="doRemoveEntry()" type="button" value="<MT_TRANS phrase="Delete Entry">">
    and insert the following line after it:
    	<input class="button" onClick="doRebuildEntry()" type="button" value="<MT_TRANS phrase="Rebuild">">
  5. Add a “Rebuild” button for the bottom of the page
    Repeat previous step (the code that displays the buttons is in two locations because you can choose display the buttons on top or bottom of the page).
  6. Save the file.
Version History
  • 2.0 October 27, 2003
    Added old_status=2 to the URL to prevent pinging after page is rebuilt.
  • 1.0 March 5, 2003
    Initial hack
The site database appears to be down.