Not a developer? Go to

Plugin and Theme Directory

EntrySetBasename v1.0

By Brad Choate
Posted September 11, 2008, in Utilities.



This is a utility plugin to assist in setting entry basenames to the value of the dirified entry title.

WARNING: Using the <$mt:EntrySetBasename$> tag will cause Entry basenames to be changed in the blogs database. This plugin and the tag is provides is meant to be used once to set basenames and then it should be removed.


In MT4.2 the dirify function was updated to not remove dashes. If the phrase to dirify was:

Foo-Bar Baz

Dirify in MT4.1 would produce:


Dirify in MT4.2 would produce:


This change to the dirify function has affected urls of blogs which use a dirified entry title in the archive map, such as in this example:

archives/<$mt:EntryTitle dirify="1"$>.html

Though MT tags can be used to create archive mappings, because there is a specific tag for doing this, it is kind of a hack… albeit a popular one!

This was most-commonly used to overcome the 100 character default limit (which can be increased to 250 in Entry Settings) but could have also been lack of knowledge of how the <$mt:EntryBasename$> works.

Though MT tags can be used to create archive mappings, the entry basename was meant to be used when creating urls to the entry because the basename is created to be unique among all entries and never changes once the entry is published. A dirified entry title will change if the title of the entry changes or… if the dirify function changes. So ideally basename should be used when creating archive mappings.

  • how entry basename is created when creating an entry

There are a few limitations with basename, but since :

  • it must be 250 characters or less
  • it is limited to letters, numbers, dashes, and underscores


The basic solution is to populate past basenames with previously dirified entry titles.

By hand this could be difficult—but thanks to Mr. Brad Choate—there is a super simple utility plugin to help!

WARNING: But please be warned, using the <$mt:EntrySetBasename$> tag will cause Entry basenames to be changed in the blogs database. This plugin and the tag is provides is meant to be used once to set basenames and then it should be removed.

  1. As always when performing massive changes to data, create a backup in the case that you need to revert.
  2. Install EntrySetBasename plugin.

  3. Set basename length to 250 (or desired length) in Preferences > Entry Settings

  4. Update archive mappings to use basename. Thus this mapping:

    archives/<$mt:EntryTitle dirify="1"$>.html

    would become:

  5. Create an index template named “Dirify” and paste the following code:

        <$mt:setvar name="first_entry_id_in_4_2" value="12345"$>
        <mt:Entries lastn="99999">
            <$mt:EntryID setvar="entry_id"$>
            <mt:if name="entry_id" lt="$first_entry_id_in_4_2">
                <$mt:EntryTitle dirify="1" setvar="new_dirified_title"$>
                <$mt:EntryTitle regex_replace="/-/g","" dirify="1" setvar="old_dirified_title"$>
                <mt:if name="new_dirified_title" ne="$old_dirified_title">
                        <$mt:EntrySetBasename value="$old_dirified_title" test="1"$>

    This code will output a page listing the entries in your blog if the entry id is less than the id of the first entry created in MT4.2 and if the title dirified previous to MT4.2 and dirified in MT4.2 are not the same. For each matching entry the basename will be set to the value specified on the mt:EntrySetBasename tag, if the test attribute is not set to 1.

  6. If you have created posts since upgrading to MT4.2, find the id of the first post created in MT4.2 and enter the id number as the value for the variable “firstentryidin4_2”.

  7. If you have more than 99999 entries, update the lastn value of the <$mt:Entries$> loop to be higher than the number of entries you have in your blog.

  8. Save the “Dirify” index template with the code above and modifications in the last two steps and publish it. Because the EntrySetBasename tag has a test attribute set to 1, no basenames will be rewritten.

  9. Review the published output from the Dirify index template to review the changes that will be made. They will look similar to this:

    • Entry #1921, ‘NY-Times Shocker’ basename set to ‘nytimes_shocker’

    If you’d like to have more testing data (and a link to directly edit the entry) add these lines before the <$mt:EntrySetBasename$> tag inside the HTML list item (placing after the tag will effect output of the <$mt:EntryBasename$> tag):

    EntryBasename: <$mt:EntryBasename$><br />
    EntryTitle: <$mt:EntryTitle$><br />
    new_dirified_title: <$mt:Var name="new_dirified_title"$><br />
    old_dirified_title: <$mt:Var name="old_dirified_title"$><br />
    <a href="<$mt:AdminScript$>?__mode=view&amp;_type=entry&amp;id=<$mt:EntryID$>">Edit Entry</a><br />
  10. Once you are ready to set all the basenames to the pre-MT4.2 dirified title, remove the “test” argument from the mt:EntrySetBasename tag and republish the Dirify index template. So that

    <$mt:EntrySetBasename value="$old_dirified_title" test="1"$>


    <$mt:EntrySetBasename value="$old_dirified_title"$>
  11. Uninstall the plugin and delete the Dirify index template.

  12. Republish your Blog.


  • Version 1.0 - Initial Release - Tag code by Brad Choate. Documented and tested by Beau Smith.


Movable Type versions: 4.3




supert on March 7, 2017, 11:05 p.m. Reply

Thanks for the development of this plugin works perfectly

novinhas xvideos xvideos videos pornô


linkerseo on April 9, 2018, 2:20 p.m. Reply

Hello there! This is my first visit to your blog! We are a group of volunteers and new activities in a similar specialty. Blog gave us valuable data to work. You have completed an astonishing activity! Stephen Pierce

james jack

james jack on April 11, 2018, 10:18 a.m. Reply

page where it is cool described.    <a href="">Preventivo ristrutturazione</a>
james jack

james jack on April 13, 2018, 3:50 a.m. Reply

I simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blog. Security Berlin

Tim Connor

Tim Connor on April 14, 2018, 8:25 p.m. Reply

Thanks for the great article!

Tim Connor

Tim Connor on April 14, 2018, 8:48 p.m. Reply

Thanks for the great article!


linkerseo on April 20, 2018, 12:27 p.m. Reply

We cover all the necessary services to bring you from a business concept idea to a concrete successful Initial Coin Offering. With and thanks to our business partners, we customize and manage the entire process to let your ICO successful, safe, and compliant accordingly. ico management


stylishfloor on April 28, 2018, 1:30 a.m. Reply

Thanks for this plugin!

church in Wake Forest


linkerseo on May 1, 2018, 2:44 p.m. Reply

If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place.We offer the fastest Illinois license plate sticker renewals in the state!..Zwembaden


pioneerseo on May 16, 2018, 6:19 p.m. Reply

Uncommon tips and clear. This will be to a great degree supportive for me when I get a chance to start my blog. web proxy


pioneerseo on May 18, 2018, 10:14 a.m. Reply

I will really appreciate the writer’s choice for choosing this excellent article appropriate to my matter.Here is deep description about the article matter which helped me more. Silsila Badalte Rishton Ka


pioneerseo on May 18, 2018, 6:07 p.m. Reply

Ordina su il tuo panino preferito a Milano, scegli il tuo preferito tra una lista delle migliori paninerie e questo ti verrà consegnato a casa! Hamburger a domicilio


pioneerseo on May 19, 2018, 3:17 p.m. Reply

Astounding, this is awesome as you need to take in more, I welcome to This is my page. cedar roofing contractor

Leave a Comment