Hi,
Great post.
I have MT myself for my .dk website and will definitely try your code on it.
Thank you for sharing it with us.
Regards,
Nikolaj
A few people asked me how to customize MovableType to add advertising posts on the individual archives, category pages, and main pages in MovableType powered blogs.
MovableType is fairly easy to customize, but you have to customize the different templates differently. I have been a bit slow to getting around to doing this, so sorry on that.
The MovableType templating system has a couple important features that make this easy to do. The three big things you need to know are:
So you start your blog and you have your container and whatnot. The first thing you need to decide is how many posts you want to show above your advert. Currently I show 1.
So you start your content area, and after the div id=content you enter
<MTEntries lastn="1">
So my home page content container area starts with
<div id="container">
<div id="content">
<MTEntries lastn="1">
<$MTEntryTrackbackData$>
<div class="post">
<a name="<$MTEntryID pad="1"$>"></a>
<h2><$MTEntryTitle$></h2>
<MTDateHeader><div class="date"><$MTEntryDate format="%b"$><br /><$MTEntryDate format="%e"$></div></MTDateHeader>
<div class="entry">
<$MTEntryBody$>
<MTEntryIfExtended>
<p><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>
</div>
<div class="post_meta_left">
<p class="categories">Posted in: <MTEntryCategories glue=" "><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories></p>
<p class="post_author">by <a href="http://www.seobook.com/about.shtml">Aaron Wall</a></p>
</div>
<div class="post_meta_right">
<MTEntryIfAllowComments>
<p class="thoughts"><a href="<$MTEntryPermalink$>#start_comments">Your Thoughts?</a> [ <$MTEntryCommentCount$> ]</p>
</MTEntryIfAllowComments>
<p class="perma"><a href="<$MTEntryPermalink$>"><$MTEntryDate format="%x"$></a></p>
</div>
</div>
</MTEntries>
If you wanted 2 posts above the advert post the above would be lastn=2.
After you create your first post you can include the advert post. I recommend creating a mini post instead of placing a huge advertisement. I probably would do better if I had an autoresponder series in a small advert post rather than my current ebook one.
To input your advertisement post you can create a backdated post and then just include that in the templating system. My post 142 is my advert post. So for me the code looks like this
<MTEntry id="142">
<div class="post">
<h2><$MTEntryTitle$></h2>
<div class="entry">
<$MTEntryBody$>
</div>
</div>
</MTEntry>
After the advertisement it is time to publish the rest of the page content. So now you need to use lastn again, but this time you have to offset it. So you use code that looks something like
<MTEntries lastn="10" offset="1">
<$MTEntryTrackbackData$>
<div class="post">
<a name="<$MTEntryID pad="1"$>"></a>
<h2><$MTEntryTitle$></h2>
<MTDateHeader><div class="date"><$MTEntryDate format="%b"$><br /><$MTEntryDate format="%e"$></div></MTDateHeader>
<div class="entry">
<$MTEntryBody$>
<MTEntryIfExtended>
<p><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>
</div>
<div class="post_meta_left">
<p class="categories">Posted in: <MTEntryCategories glue=" "><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories></p>
<p class="post_author">by <a href="http://www.seobook.com/about.shtml">Aaron Wall</a></p>
</div>
<div class="post_meta_right">
<MTEntryIfAllowComments>
<p class="thoughts"><a href="<$MTEntryPermalink$>#start_comments">Your Thoughts?</a> [ <$MTEntryCommentCount$> ]</p>
</MTEntryIfAllowComments>
<p class="perma"><a href="<$MTEntryPermalink$>"><$MTEntryDate format="%x"$></a></p>
</div>
</div>
</MTEntries></div>
I simply hard coded the ad text into the template on individual entry pages. After the post and comments section were closed I added this:
<div class="post">
<h2><!--#config timefmt="%B %d, %Y" --> <!--#echo var="DATE_LOCAL" --></h2>
<div class="entry">
<p>Ad entry text</p></div>
</div>
Notice how that date of my advert uses what looks like a comment. That is actually a server side include that is used to parse the date from the local machine as being the current date. Useful to do to make your content look fresh if you are using freshness as a sales point for your software, information product, or other offer.
If you are having your site created dynamically I think you could insert that information using a php date command.
Also note that I stress the date instead of an offer. For most people the date is probably not so important, and they could probably put their post title or whatever in the H2 tag or whatever type of post heading they were using for other posts.
If you are outputting to static html files by default your server will not process server side include directives. You can set your file extensions to .shtml inside the MovableType settings, but doing that would cause you to lose whatever link equity you have built up from pages located at the old locations.
Instead, you can configure your .htaccess file so that your site processes .html or .htm files as though they were .shtml. Your .htaccess file is simply named .htaccess and exists in the root of your site. Please note that some FTP programs do not show .htaccess files, so you may want to ask your host if you have one if you can't find it.
Please note that I do not recommend screwing with your .htaccess file on an important site without supervision, as a poorly configured one can cause a site to not load at all. I have temporarily screwed up a number of my sites playing with them...but you have to learn somehow. Also, make a copy of your htaccess file before screwing with it.
Also be aware that you may already have a .htaccess file that you do not want to write over. Instead download it to your local machine. After you download the file change it from .htaccess to htaccess.txt. After whatever code is already in it you can add
AddType text/html .shtml
AddHandler server-parsed .htm
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Save that file. Then change it from htaccess.txt to .htaccess and upload it to the server in the root of your site.
Here I just inserted the post after the opening container and content area
<MTEntry id="142">
<div class="post">
<h2><!--#config timefmt="%B %d, %Y" --> <!--#echo var="DATE_LOCAL" --></h2>
<div class="entry">
<h2><$MTEntryTitle$></h2>
<$MTEntryBody$>
</div>
</div>
</MTEntry>
If you have further questions I probably can't answer them, but I hope that helps a few people.
New to the site? Join for Free and get over $300 of free SEO software.

Once you set up your free account you can comment on our blog, and you are eligible to receive our search engine success SEO newsletter.
Already have an account? Login to share your opinions.
Hi,
Great post.
I have MT myself for my .dk website and will definitely try your code on it.
Thank you for sharing it with us.
Regards,
Nikolaj
New to the site? Join for Free and get over $300 of free SEO software.

Once you set up your free account you can comment on our blog, and you are eligible to receive our search engine success SEO newsletter.
Already have an account? Login to share your opinions.



Visit PPC Blog, our new sister site focused on pay per click marketing.
Join our training program today and get the Google rankings, search traffic, growth, and profits you deserve!
Not convinced? Try our free 7-day course for beginners. After viewing it we hope to see you join our community! Best of luck growing your business & we hope our site helps increase your rankings!
In Short? We offer the #1 SEO training program. And it comes with tools, videos, a private member's forum, and so much more.

