If you operate a team blog and wondering how to have blogger automatically create search links to bring up all of one authors posts, this quick guide will give you all the code needed. It doesn't take a lot of code to do it, and if you know what you are doing you can easily trim my code down to one line, but for readability I am posting it as is.
What we will do is modify the the "Posted by Author Name" line to link Author Name to a label search for Author Name.
First, navigate to your template's HTML and expand the widget code. In your post includible section, you are going to want to find the author code below (note: it may be slightly different):
<div class='post-header-line-1'><span class='post-author vcard'>
<b:if cond='data:top.showAuthor'>
<data:top.authorLabel/>
<span class='fn'><data:post.author/></span>
</b:if>
</span>
What we need to do is replace the above author line (in bold) with the following script:
<script type="text/javascript">
/*
Author Label Links
by Raymond May Jr.
http://www.compender.com
Released to the Public Domain
*/
var author = '<data:post.author/>';
var linkURL = '<data:blog.homepageUrl/>' + "search/label/";
document.write("<a href='" + linkURL + author + "'><span class='fn'>" + author + "</span></a>");
</script>
Now, for the links to return any results you need to tell your authors to label their posts with their author name exactly as it shows in their profiles.
That's it!
0 comments:
Post a Comment