Thursday, September 15, 2005

Flagging Guest Posts

Blog Tips BasilThis is a new one that I implemented here on my little blog ... today! I've been working on it for a while, but just got the solution within the last 24 hours. And, son-of-a-gun, it works! And I just have to share it.

This tip is for those bloggers that have guest bloggers. That's becoming more and more prevalent. And, if you have a primary author (say, for example, you), but have occasional posts by others, you might want folks to easily know who wrote it.

There are a couple of ways to do that.

One is to have the author listed at the top of the post. That way, when someone starts reading, they immediately see who wrote it. And, some blogs do just that.

However, it's most common to have post information listed at the bottom of the post. Blogger, for example, by default, has its templates set up to show the author at the bottom of the post, along with the date/time of the post and the comments link. TypePad (and most MovableType) templates do the same.

Now, it's always possible to move the author information to the top. While that's not standard, it's certainly done. Some even move all the information (date/time, comments, TrackBacks, etc) to the top. IMAO does this, for instance.

But, like I said, most blog templates have all that information at the bottom.

Now, you might ask, is this really a big deal? Well, yeah, it can be. From an ego standpoint of the guest blogger, for instance. If someone takes the time to agree to post for you, they should certainly receive credit for their work.

At this little blog, from time to time a guest blogger will post. And I want them to get credit for their work. More than once, I received credit for someone else's writing. So, to avoid such a situation, it's important to me that guest bloggers receive proper credit for their work.

But, I also want the author information to appear at the bottom of the post with the rest of the traditional information.

So, I could have the author's name appear at the top of the post, just under the title, in addition to appearing at the bottom. But, I only wanted that to happen for guest bloggers. For posts I wrote, I didn't want my byline to be at the top and bottom of the post, just at the bottom with the standard information.

How do you accomplish this? It's actually easier than you might think. But it involves CSS.

The general idea is to modify your template to add code that displays the author name at the top of the post. Then wrap it in a style that causes the code to be hidden if the author is you.

Now to the details.

Blogger Templates

First, back up your Template. If you don't know how, you ought to read this.

If you use Blogger, open the Template. From the Dashboard, that's "Change Settings" then the "Template" tab.

Scroll down until you find <$BlogItemBody$> in the code. That's where the main body of the post will appear.

Immediately before that (you might want to add a blank line or two) is where you'll add your code.

Insert the following:

<p class="post-footer">
<span class="<$BlogItemAuthorNickname$>">
<em>posted by
<$BlogItemAuthorNickname$></em><br />
</span>
</p>


That will cause the name of the author of the post to appear. But
notice the <span class="<$BlogItemAuthorNickname$>"> part.
That will apply a special style class to that section of the code.

Now, to put that special class to work, let's move up the Template
code to where the styles are applied. The style section ends with a
</style> tag.

Just above that, add this:

.authorname { 
    display: none;
}


Now, here's the real tricky part. Do not type "authorname" there.
Instead, type what normally displays as your author name. For example,
mine says

.basil { 
    display: none;
}


and yours would say whatever your author name is.

TypePad Template

First, you'll need to use Advanced Templates. Then, you should back up your Templates. If you don't know how, try this post.

Next, let's add the stylesheet code.

Click the "Design" tab. Then, under "Index Templates" click on "Stylesheet."

From the Stylesheet, scroll all the way down to the bottom. Then add this code:

.authorname { 
    display: none;
}


Now, here's the real tricky part. Do not type "authorname" there.
Instead, type what normally displays as your author name. For example,
mine says

.basil { 
    display: none;
}


and yours would say whatever your author name is.

Click "Save", "Publish", and in the pop-up window, "Publish." When done, click "Close" and the pop-up closes.

Now, open the specific Template you want to edit.

Click "Edit Current" then select "Main Index Template."

Find </MTWeblogPostIfShow> in the code. Just above that (you might want to insert a blank line or two)add:

<p class="entry-footer">
<span class="post-footers">
<span class="<$MTEntryAuthor$>">by:
<$MTEntryAuthor$></span>
</span>
</p>

Now What?

Once you save and publish, it should work. Check it out. Look at
your posts. No name at the top, right? Now, look at a post that a guest
blogger wrote. You should see the name.

If so, great! Everything works. If not, now would be a good time to restore your Templates. Like it says here.

If you have a question about topics like this, or a question about
other blogging tips, or blogging etiquette, head over to the Alliance. They have blogging tips such as this one. And a couple of gurus there on staff. Either phin or his assistant will be able to help.

No comments:

Post a Comment

Please choose a Profile in "Comment as" or sign your name to Anonymous comments. Comment policy