September 11, 2004

Keeping an Entry at the Top

Sometimes you may want to keep an entry, or all entries within a certain category, at the top of your weblog, above all of your other entries. For example, you may want to highlight announcements at the top of your site, or you might have a site explanation or introduction that you wish to maintain at the top. There are several ways to accomplish this.

1. Changing the date of the entry.

authored_on.gifIf all you want to do is to put one particular entry at the top of your blog, perhaps only for a limited time, the easiest way to accomplish this is to give it a date that is posted at a later date than all of the other entries. To do this, in the edit entry window, scroll to the bottom of the page. On the left is an "Authored on" area. Enter a date more recent than, or in the future of, all of your other entries. The problem with this is that if you choose a date far out in the future, and you display prominently the date posted, it will look a little weird to anyone reading it.

2. Hard-coding your entry into the Main Index Template

If the content you want at the top of your page doesn't change, the most practical thing to do is to put the text in the Main Index or archive template where you want the content to appear. In MT3, put the content between the content div class and the MTEntries tag like so:

<div id="center">
<div class="content">

Your text would go here for MT3...


For MT 2.x put the content between the blog div class and the MTEntries tag like so:

<div id="content">
<div class="blog">

Your text would go here for MT2.x....


3. Use the Entry plugin.

You can specify an entry in your template layout by the ID of the entry using David Rayne's Entry plugin.

<MTEntry id="118">
<$MTEntryTitle$><br />

Place the MTEntry code, with the entry ID you have specified, above your existing MTEntries tag in your Main Index template. You can find the entry ID by looking at the browser URL window while editing that entry.

4. Place the entries of only one category at the top

If you want only the entries of a certain category to stay at the top of your blog, for example an "announcements" category, you can do that easily by adding the following code to your Main Index template before the existing MTEntries tag:

Using MT3 template tags put the following code after <div id="center"><div class="content">

<MTEntries lastn="1" category="Put_the_name_of_category_here">
<h2 class="date">
<$MTEntryDate format="%x"$>
<h3 class="title"><$MTEntryTitle$></h3>
<p class="extended"><a href="<$MTEntryPermalink$>">Continue reading "<$MTEntryTitle$>"</a></p>

<p class="posted">Posted by <$MTEntryAuthor$> on <$MTEntryDate format="%x"$> to <MTEntryCategories glue=", "><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a>

Using MT2.x template tags, put the above code after <div id="content"><div class="blog">. Change the style tags and template tags in the code listed above to reflect MT2.x tags.

This method will put the latest entry from your specified category in the top spot.

If you follow this method, you may also want to exclude entries from the specified category in your general list of entries. To do this, use the ExcludeCategories plugin. With this plugin installed, all you need to do to exclude a category is to change your <MTEntries> and </MTEntries> tags of your main body of entries in your Main Index template to <MTEntriesExCat category="Put_the_name_of_category_here">, and its complementary closing tag.

You may also want to style this section differently, as I have done here on the main page of LMT by placing a border and a different background color around the latest announcement. To do this, add a new class on your stylesheet. For example, I've created a new class on the LMT stylesheet called "announcement":

.announcement {
padding: 10px 10px 10px 10px;
background-color: #effbdb;
border: solid 1px #7c9e40;

On your Main Index template add the new div class, nesting the top entry section between the opening and closing div tags of the new class. In my example, the div class tag is <div class="announcement">.

5. Use the MultiBlog plugin

You can use David Rayne's MultiBlog plugin to pull in entries from other blogs to take a preeminent position on your weblog. (See Combining Multiple Blogs into One tutorial.)

Has this tutorial been helpful? Please consider linking to Learning Movable Type at . Thanks!

Posted by Elise Bauer on September 11, 2004 to General Tips and Tricks, Style
Comments(1) | Email to a friend | Printer-friendly version


If you would like to send a trackback
please use the following URL:


I love the CSS you posted, the colours go so well together. Using it on Movalog - trashed the yellow/green code blocks !

Comments are now closed for this entry.

Email to a friend

Email this article to:

Your email address:

Message (optional):