Code to use Backlinks on Custom Blogger Templates

...

Backlink tags: There are two sections of template code that relate to backlinks. One section simply creates the links that readers see next to your posts. The other section displays the backlinks themselves. We'll look at these two parts separately.


Backlink indicator:

The following piece of code will print a link reading "Links to this post." It should be placed between the <Blogger> and </Blogger> tags that display your posts, and you'll probably want it in the byline, near the author's name and the comments links.


<BlogItemBacklinksEnabled>
<a class="comment-link" href="<$BlogItemPermalinkUrl$>#links">
Links to this post</a>
</BlogItemBacklinksEnabled>

First, notice the <BlogItemBacklinksEnabled> tags that surround the others. This is so the rest of the code will only be displayed on posts for which backlinks are enabled. Then, the link tag points to the post page where the backlinks will be listed in detail. You can put whatever text you like in place of "links to this post."

Displaying the backlinks:

This part of the code will also go between the <Blogger> and </Blogger> tags, but you will probably also want to enclose them in <ItemPage> and </ItemPage> tags as well, so the backlinks only appear on your post pages, and don't clutter up the main page of your blog.



<BlogItemBacklinksEnabled>
   <a name="links"></a>
   <h4>Links to this post:</h4>
   <dl id="comments-block">
   <BlogItemBacklinks>
       <dt class="comment-title">
       <$BlogBacklinkControl$>
       <a href="<$BlogBacklinkURL$>" rel="nofollow">
       <$BlogBacklinkTitle$></a> <$BlogBacklinkDeleteIcon$>
      </dt>
       <dd class="comment-body"><$BlogBacklinkSnippet$>
       <br />
       <span class="comment-poster">
       <em>posted by <$BlogBacklinkAuthor$> @ 
       <$BlogBacklinkDateTime$></em>
       </span>
       </dd>
   </BlogItemBacklinks>
   </dl>
   <p class="comment-timestamp"><$BlogItemBacklinkCreate$></p>
</BlogItemBacklinksEnabled>


Once again, we've enclosed everything in <BlogItemBacklinksEnabled> so posts that don't allow backlinks won't print anything.
The <BlogItemBacklinks> tags mark the section of code that cycles through each backlink to print it out. The <$BlogCommentAuthor$> and<$BlogCommentDateTime$> tags print out the information you would expect them to, and the <$BlogBacklinkSnippet$> tag shows a small portion of the text from the page in question.
Finally, there are a couple little tags to round out the functionality.<$BlogBacklinkDeleteIcon$> inserts a delete button for each backlink, but only if the person viewing it is an administrator of the blog. No one else is allowed to delete backlinks. The delete button works the same as it does for comments.<$BlogItemBacklinkCreate$> creates a link to BlogThis!, which readers can use to write their own blog entries linking to your post.

[Source]

...

0 comments:

Post a Comment