A Couple of Movable Type Tips

September 18th, 2009 | 1 Comments | Tech Stuff |

This may be a Word­Press blog, but back at the office we’re a Mov­able Type shop. Talk­ing at lunch today, we decided that the real mean­ing of “Enter­prise Edi­tion” is, “you bet­ter have an enter­prise back­ing you up on this,” because the doc­u­men­ta­tion is, ahem, incomplete.

But here are a cou­ple of theme– and style-related tweaks you should know.

MT calls its themes “styles” in the GUI, but “themes” in the filesys­tem; and if you look through their doc­u­men­ta­tion you’ll find next to noth­ing. There’s no way to add a style, or a style cat­e­gory, directly through the GUI. All the work has to be done in the code itself.

In our Enter­prise Edi­tion we have four dif­fer­ent styles within the Pro­fes­sional Web­site cat­e­gory, Pro­fes­sional Black, Pro­fes­sional Blue, Pro­fes­sional Green and Pro­fes­sional Pink. We wanted to add a cus­tom ver­sion that stu­dents were going to use for a freshman-level class. The basic steps were:

  1. Clone one of the exist­ing tem­plates: just by copy­ing the direc­tory and re-naming it. In the case of the Pro­fes­sional Web­site tem­plates, these are in /mt-static/Commercial.pack/themes/.
  2. Change the col­ors and the header image to some­thing more rel­e­vant: upload an image of the appro­pri­ate size, change the css file to point to it instead.

    That much is pretty obvi­ous. Here’s what you do next:

  3. Rename things: Change the direc­tory name to some­thing dis­tinct. I used “professional-shufs”. Change the screen.css file header lines to match, par­tic­u­larly the sec­ond line:

    name: Professional SHUFS, a Theme for SHU Freshman Studies
    And the rest of it as needed.

  4. Make thumb­nails: Take a screen grab of your theme in use, and make two thumb­nails. One should be 120px high by 90px wide and named thumbnail.gif; the other 278px wide by 209px high and named thumbnail-large.gif. Upload these to your new theme’s direc­tory, over­writ­ing what’s there already.
  5. Mod­ify the index: This is what makes it actu­ally appear. Open /mt-static/addons/Commercial.pack/themes/professional.html. You’ll see a chunk that looks like this:
    <link rel="theme" type="text/x-theme" href="professional-black/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-blue/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-green/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-pink/screen.css" />

    You’re going to add a line to point to your new style:
    <link rel="theme" type="text/x-theme" href="professional-black/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-blue/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-green/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-pink/screen.css" />
    <link rel="theme" type="text/x-theme" href="professional-shufs/screen.css" />

The new style should now be one of the choices in the GUI.

Adding a new cat­e­gory of styles

In the “Select a Style” page there’s a micro­scopic “+” icon at the top of the left col­umn. Click on it and it asks you for a Stylesheet or Repos­i­tory URL. Hmm. What?

We have to back up a lit­tle and cre­ate a Repos­i­tory URL. Let’s say that you’ve cre­ated two themes, and put them into the filesys­tem at /mt-static/themes/my-new-website and /mt-static/themes/my-new-blog. You need to cre­ate a Repos­i­tory URL that points to the CSS files for each. The Repos­i­tory URL is a file that looks just like index.html above. In the section, you'll have theme links to the two you've set up. Open up a blank text file and put in something like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>My Style Library</title>

<link rel=“theme” type=“text/x-theme” href=“http://foo.bar.com/mt-static/themes/my-new-website/my-new-website.css” />
<link rel=“theme” type=“text/x-theme” href=“http://foo.bar.com/mt-static/themes/my-new-blog/my-new-blog.css” />

</head>
<body>
<p>This is the Mov­able Type 4 style library for my new styles.</p>
</body>
</html>

An impor­tant thing to notice here: The CSS files in each theme have dif­fer­ent names. That’s a must, appar­ently, even though it doesn’t seem to be required for the mod­i­fi­ca­tion we did to the Pro­fes­sional Pack above.

Save that file to your web server, let’s say it’s at http://​foo​.bar​.com/​m​t​-​s​t​a​t​i​c​/​t​h​e​m​e​s​/​n​e​w​t​h​e​m​e​s​.​h​tml.

Go back to your MT GUI and click that green plus sign again, and enter that URL. Let it go through it’s machi­na­tions and you’ll see a new cat­e­gory in your left column.

What’s inter­est­ing about this is that your newthemes.html file can point to any of the themes you have on your site, wher­ever they hap­pen to be. So you can have the same theme in mul­ti­ple cat­e­gories with­out dupli­cat­ing them in the filesystem.

Cus­tom Ban­ner Images

One of the first ques­tions we get here is, “how do I get rid of the chicken?” Long story, but the Pro­fes­sional Black style looks like this, out of the box:
thumbnail-large

We’d read that at Penn State they’d mod­i­fied the sys­tem so that their users could upload their own image to replace the default. The solu­tion is pretty sim­ple, and I think I’ve recre­ated it. This is only tested with tem­plates in the pro­fes­sional pack; the details will vary if you are using a dif­fer­ent tem­plate set.

First off, the user, within their blog, needs to upload a new asset. In the admin­is­tra­tive screen, go to “Create::Upload File”. Cre­ate a file that is 905px wide by 170px high and upload it. In the File Options screen, uncheck “Cre­ate a new entry using this uploaded file, and give it the tag “@banner”. Then click finish.

That, in and of itself, does noth­ing. You have to mod­ify your tem­plate accord­ingly. Go into “Design::Templates” and click on the Stylesheet (styles.css) link. You’re going to add a line to the very bot­tom of whatever’s there.
<mt:Assets lastn="1" type="image" tag="@banner">
#homepage-image { background: url(<mt:AssetURL>) }
</mt:Assets>

This is going to take one sin­gle asset, of type image, with the tag “@banner”, and apply that asset’s URL as the background-image of #homepage-image. Save & Pub­lish, refresh your page and you should be good to go.

Tags: , ,

One Response to ' A Couple of Movable Type Tips '

Leave a reply


Subscribe to comments with RSS or TrackBack to ' A Couple of Movable Type Tips '.

September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  

New on Flickr

Inquisitive
Small Ferns
Tillman Ravine
Tillman Ravine
Bunny Kiosk
Snow melt, Mahlon Dickerson Reservation
Late afternoon, Dickerson Reservation
Sandy Hook LIghthouse