A default MT4 blog comes with a list of Monthly Archives in the sidebar.  For many blog purposes (LMT an example) you don't really need to show archives by month. A category listing will suffice.

Here are the steps to get rid of the monthly archives and to remove them from your sidebar.

1.  From your main blog edit window, click on "Design" in the top horizontal navigation bar.  Then click on "Templates".  Scroll down to "Archive Templates" and click on "Monthly Entry Listing".

2. Scroll down and click on "Template Options". Where it says "Archive Mapping", see "Monthly" under Type, click on the little trash can icon to the right of it to delete this archive mapping.  Click "Save & Publish".

3. Then repeat this on the other archive templates such as Category Listing and Entry.

Rebuild your site.

Links:

1.  Create Custom Fields

In System Overview, select Preferences > Custom Fields

Select +New Field

2.  Edit Registration Form

Go to System Overview > Design > Templates > Registration Form

Add this code:

<mt:loop name="field_loop">
<mt:if name="__first__">
<input type="hidden" name="customfield_beacon" value="1" id="customfield_beacon" />
</mt:if>
<!-- start-customfield_<mt:var name="basename"> -->
<mtapp:setting
id="$field_id"
label="$name"
hint="$description"
shown="$show_field"
show_hint="$show_hint"
required="$required">
<mt:var name="field_html">
</mtapp:setting>
<!-- end-customfield_<mt:var name="basename"> -->
</mt:loop>

Then select Save.

3.  Edit Profile Form

Go to System Overview > Design > Templates > Profile Edit Form

Add the same code as above.

4.  If you only want to display one custom field in certain area on a form, and not all of them in a row, then use If statements.  Here's an example if the custom field you want to use is named "Website Name" with a basename of "website_name".

<mt:if name="field_id" eq="customfield_website_name">
</mt:if>

Your custom field's basename, preceded by "custom field".

Example:

<mt:loop name="field_loop">
<mt:if name="__first__">
<input type="hidden" name="customfield_beacon" value="1" id="customfield_beacon" />
</mt:if>
<!-- start-customfield_<mt:var name="basename"> -->
<mt:if name="field_id" eq="customfield_website_name">
<mtapp:setting
id="$field_id"
label="$name"
hint="$description"
shown="$show_field"
show_hint="$show_hint"
required="$required">
<mt:var name="field_html">
</mtapp:setting>
</mt:if>
<!-- end-customfield_<mt:var name="basename"> -->
</mt:loop>

Thanks to Aaron Vanderzwan for this last tip.


Have you ever wanted an easy way of showing a simple feed of your favorite sites within your blog? Blogger has a cool new feature called Blog List for Blogger blogs, and even if you are using Movable Type, or another blogging platform, you can make use of this Blogger feature to pull feeds into your blog.

Here's what it looks like on my site - Simply Recipes: Food Blog Updates:

updates-screen-shot.jpg

Which is driven off of this Blogspot page: http://foodbloglinks.blogspot.com/.

It's very easy to set up. Here are the steps in detail:

MultiBlog and Upgrading to MT4

| 1 Comment

If you use the MultiBlog plugin by David Rayners and you upgrade to MT4, when you go to rebuild your site, you may get the following error message:

"Publish error in template 'Main Index': No handler exists for tag MultiBlogEntries"

The MultiBlog functionality is now part of MT4. All you have to do to update your templates is to change every instance of the tags MTMultiBlogEntries or MTMulitBlog to MTEntries and rebuild your templates.

So <MTMultiBlogEntries include_blogs="2,5" lastn="10"> and </MTMultiBlogEntries> become <MTEntries include_blogs="2,5" lastn="10"> and </MTEntries>.

This article was first published at Movable Tweak.

This little snip of code will dump out a list of all the users and their email addresses on your install in a comma-delimited format that you can easily import into your email client. It’s particularly useful on larger installs:

<mt:Authors include_blogs="all">
    <mt:IfNonEmpty tag="AuthorEmail">
        <mt:IfNonEmpty tag="AuthorDisplayName">"<mt:AuthorDisplayName />" </mt:IfNonEmpty>
        &lt;<mt:AuthorEmail />&gt;,
    </mt:IfNonEmpty>
</mt:Authors>

And the Authors tag allows for all sorts of cool filtering attributes so you can get at any group of authors in the system, ordered however you like:

  • display_name: Specifies a particular author to select.
  • lastn: Limits the selection of authors to the specified number.
  • sortby: Supported values: displayname, name, created_on.
  • sort_order: Supported values: ascend, descend.
  • roles: comma separated list of values. eg “Author, Commenter”
  • need_entry: 1 | 0 (default is 1)
  • status: Supported values: enabled, disabled. Default is enabled.

Note: Some people have asked about creating an email list of all the commenters on the system, and it’s very simple. The code stays the same, but you just need to specify roles=”Commenter” and need_entry=”0” (since most commenters won’t have written an entry). Here’s the code to do it:

 <mt:Authors include_blogs="all" roles="Commenter" need_entry="0" sort_by="display_name"><mt:IfNonEmpty tag="AuthorEmail"><mt:IfNonEmpty tag="AuthorDisplayName">"<mt:AuthorDisplayName />" </mt:IfNonEmpty>&lt;<mt:AuthorEmail />&gt;, </mt:IfNonEmpty>
 </mt:Authors>

Notice the code is much more compressed than the code given previously. If you tried the previous code, you probably noticed that the spacing is crazy because of all the hard returns and spaces we have in there. This second set of code I posted will give you a highly compact list of email addresses than can literally be copied and pasted into an email client.

Just make sure you use this for good, not evil.

Upgrading to MT4

| No Comments

Over the last few major version changes, Learning Movable Type has published guides to upgrading safely, without risk of messing up your blog. The most recent tutorial was A Safe Way to Upgrade to MT3.3.

The three main steps that still hold for safely upgrading to MT4 (from MT3) are:

  1. Make a back up of your database.
  2. Make sure all the plugins you use for your site have upgrades that are compatible with the new version.
  3. Install MT into a new directory in your cgi-bin. Do NOT overwrite your existing MT directory.

The Movable Type ProNet community has done a stellar job in outlining everything you need to know to do a successful upgrade to MT4. These instructions can be found at the MT Community Wiki in the Community Generated Upgrade Guide.

Please see the instructions at the Community Wiki for the specific details on how to safely upgrade your MT blog to MT version 4.

Creating a custom button for your blog to be used on the Google Toolbar is a great way to promote your blog. Once installed, the button can act as a graphical bookmark to your site. You and your readers can search your site using the search bar in the Google toolbar, without having to be on your site. In fact, you can highlight any text on any web page, click on your custom icon in the browser, and you will perform a search the text you just highlighted on your blog. The custom button can even list your last several entries, with data pulled from your feed.

Google toolbar example

I recently updated my Google toolbar for Simply Recipes and created a new one for a new site, Food Blog Search. (If you want to see the Google Toolbar in action, follow the instructions to add a button on the Food Blog Search site.) Google's instructions for making a custom button can be convoluted and overwhelming. It took me several hours over several days to work out the correct code for the toolbars. So to save any of you similar pain, I'm presenting the steps here.

Step 1: Install Google Toolbar

The Google Toolbar requires using either IE or Firefox for your browser. Go to this page at Google to install it.

Recently when working on updating the Photo Gallery plugin to work with Movable Type 4.1 I found myself neck deep in some of the most complicated Movable Type templates I have ever seen. Of course, their complexity is exactly why the Photo Gallery plugin outputs such beautiful results.

Within these templates I have the need to take an arbitrary image asset of any size, and scale it proportionally to fit inside a well defined area. This could be a thumbnail, or a larger version of the photo at hand. What I found myself doing is replicating the same template code over and over again in order to produce the output I desired throughout the template set. Here is the template code I was using:

<MTSetVarBlock name="width" trim="1"><MTEntryAssets><MTAssetProperty 
    property="image_width"></MTEntryAssets></MTSetVarBlock>
<MTSetVarBlock name="height" trim="1"><MTEntryAssets><MTAssetProperty 
    property="image_height"></MTEntryAssets></MTSetVarBlock>
<mt:if name="width" gt="$height">
    <MTSetVarBlock name="img"><MTEntryAssets><mt:AssetThumbnailLink width="90" 
        regex_replace="/^<a[^>]*>(<img[^>]*>)<\/a>$/","$1" /></MTEntryAssets></MTSetVarBlock>
<mt:else>
    <MTSetVarBlock name="img"><MTEntryAssets><mt:AssetThumbnailLink height="90" 
        regex_replace="/^<a[^>]*>(<img[^>]*>)<\/a>$/","$1" /></MTEntryAssets></MTSetVarBlock>
</mt:if>

Yikes.

To complicate things further, each time I cut and pasted this code around I had to modify it slightly depending upon the size of the photo I wanted to output. This presented the following problems:

  • my template code was getting very messy.
  • my template code was getting harder and harder to update because I had the same code in multiple places

What I found myself in need of is something a developer might call a "function" or "macro." In layman's terms, I needed a way to write this template code once, and then to invoke along with a few parameters in order to change its behavior and output as needed.

Luckily, Movable Type has exactly what I needed: a little template tag called MTSetVarTemplate. This template tag allowed me to define just such a macro so that I could reduce all of the complicated template code above into something far simpler:

<MTVar name="photo" max_size="90">

Wow, what an improvement!

How to Customize Default Styles in MT4

| 13 Comments

Okay, so you've created a new blog in MT4. You've followed the system prompts and have picked a style from the available defaults. Now you want to customize the style you've chosen, perhaps use a different font, or a different color for an element. You go to look at the stylesheet template in Design > Templates > Stylesheet, and instead of seeing CSS code to edit, you see this:

lmt-edit-stylesheet.jpg

Now what?

In Movable Type 4.0 users had the option of offloading the task of publishing to a separate program or application called Publish Queue. This had the advantage of dramatically increasing Movable Type's performance and reliability.

Most users run Pubish Queue via a scheduled task that wakes up at a fixed internal, executes and then quits. However, some users use Publish Queue's "daemon mode" to make it so that it is always running. But its own daemon mode does not have the capability to monitor and restart itself should it unexpectedly quit, exit or die.

Should Publish Queue crash the consequence would be that publishing would simply stop without you ever really knowing about it. Plus you couldn't start it up again without you manually going into the server and starting the publish queue up again. This rarely happens in actuality, but in a business critical application, you never want this to happen. Period.

Of course this problem is not unique to Movable Type. Many programs in Linux should be running at all times to ensure that the operating system functions properly. That is why there exists a suite of utilities in Linux called "damon tools." Together these tools can be configured to monitor any script and ensure that it is always running. If the script/application dies, then daemon tools will restart it. Handy.

This article discussed the process for those unfamiliar with daemon tools with how to get started and how to configure it so that you can relax knowing that Movable Type's background publishing engine will never stop running.

Recent Comments

  • Elise: This is from an email from Beau: In the View read more
  • Mark: This is Awesome. I do not like the display of read more
  • crackzsl: Great tips . thanks for post. read more
  • Faramarz: Hello, I just went through this process and successfully installed read more
  • Chad Everett: Hi Arelav - Not sure why I didn't catch your read more
  • Gudrun: Great tutorial Elise - this was probably the single most read more
  • jelthure: Here's a link to a tutorial I wrote for horizontal read more
  • Chad Everett: Hi Diana - Not sure what you mean. First, the read more
  • diana: Chad, the code you gave is still doing pretty much read more
  • Chad Everett: Diana, that's pretty complex code (and not exactly correct) - read more

Recent Assets

  • flower2.jpg

Find recent content on the main index or look in the archives to find all content.