Thursday, June 17, 2010

How to link authors' names to profiles on your own/team blog

If you have several people posting to a blog, you might want to set it up so that each person's name at the end of their posts links to their profile. Comments currently work this way automatically, but we don't yet have this feature for regular posts. Here's a way to get around that and make it work.

First, what you'll have to do is get the profile addresses for each person who will be posting to the blog. You'll notice that each one looks something like this: http://www.blogger.com/profile/XXXXXXX where "XXXXXXX" is a particular ID number. Make a note of that number for each person.

Replace "First Member" with the name that appears on the first member's posts, and replace "XXXXXXX" with the ID number corresponding to that person's profile. Repeat for the second member and so on, adding as many more lines as you need.

Now, look at the section of your template between the <Blogger> tags, where the posts themselves are displayed. There you should be able to find the <$BlogItemAuthorNickname$> or <data:post.author/> tag, depending on what kind of template you have. This prints out each persons display name. Replace that tag with the following:
Next, add the following code to your template, between the HTML <head> tags:
<script type="text/javascript">

var team = new Array();
team["First Member"]="XXXXXXX";
team["Second Member"]="YYYYYYY";
team["Third Member"]="ZZZZZZZ";

function makeprofilelink (authorname) {
var pid = team[authorname];
document.write("<a href=\"http://www.blogger.com/profile/"
+ pid + "\">" + authorname + "</a>");
}

</script>
(for classic templates)
<script type="text/javascript"> makeprofilelink("<$BlogItemAuthorNickname$>"); </script>

(for layouts)
<script type="text/javascript"> makeprofilelink("<data:post.author/>"); </script>

When you're all done, preview it to make sure it works, then save the changes and republish. The result will be something like this at the end of each post, with the appropriate profile link for the name:
... blah blah blah and that's the end of my post.
# posted by Free Blogpot Templates at 12:09 AM.
Notes:

  • You will need to update the list of members and their ID numbers anytime you add new people, or any time they change their display names.
  • Each member will need to have a unique display name, so they will be linked to the correct profile.

2 comments:

  1. Comments currentlyguild wars 2 key work this way automatically, but we don't yet have this feature for regular posts. Here's a way to get around thatDiablo III gold and make it work.

    ReplyDelete
  2. good post keep posting. i really liked your ideas thanks for posting. cheap runescape accounts for sale

    ReplyDelete