Playing with the Feed Links

Now and then one of your questions triggers my own curiousity. Shrish asked how to hide the Feed Link at the bottom of the frontpage, while keeping the Feed Link at each postpage. And how to change the text of the link. Well, here is how it is done. A new hack.

Step 1: Backup your template.
Better be safe than sorry.

Step 2: Edit you template
Open your template in HTML-mode, and search for the includable with the id feedLinksBody. You have to add some lines of code to it to make the hack work. Below, you will find the code of the includable, the new lines are marked in red.

<b:includable id='feedLinksBody' var='links'>
<b:if cond='data:blog.pageType == "item"'>
<div class='feed-links'>
<data:feedLinksMsg/>
<b:loop values='data:links' var='f'>
<a class='feed-link' expr:href='data:f.url' expr:type='data:f.mimeType' target='_blank'><data:f.name/> (<data:f.feedType/>)</a>
</b:loop>
</div>
</b:if>
</b:includable>

Adding these 2 lines of code makes the Feed Link only show up on an Item Page, and not on the Main Page or an Archive Page.

If you want to change the text of the Feed Link from "Subscribe to:" into something else, you have to replace <data:feedLinksMsg/> with your own text.
The same can be done with the "Post Comments" text, and with the "(Atom)" text.
Just replace <data:f.name/> and <data:f.feedType/> respectively with your own text (or remove them completely).

This is what people say:

Shrish said...

Thanks Hans, It works perfectly.

But I cann't understand how to change feed link text. I tried data:feedLinksMsg='text here', but it did not worked. What is the syntax for changing this.

Hans said...

@Shrish: completely remove the <data:feedLinksMsg/>-tag, and type your text just as plain text in its place

AspiringTheologian said...

Hans,

How can I remove both the "Older Posts" link and the "Subscribe To Posts: Atom" link from the bottom of my post list?

Thanks a lot,
The Aspiring Theologian
Knight of the Living God

AspiringTheologian said...

Sorry - I just meant "Older Posts" - I already removed the atom using your above hack. Sorry for the double post.

Sumesh said...

I have done a post on how to replace the default post feed with the feedburner link, here



Sumesh
Digital Dreams

Hans said...

@AspiringTheologian: if you want to remove the Older Posts and Newer Posts links, open your template in html-mode, and look for the styledefinitions for #blog-pager-older-link and #blog-pager-newer-link, and add the line display:none; to these definitions.

AspiringTheologian said...

Thanks Hans, that was most helpful.

Eric Kamander said...

You've been a great help.

I've removed the SubscribeTo from my feed and my comments. I do have a Post link to subscribe to All Comments, but I cannot get the subscribe to this post's comments back.

Can you explain why?

My blog is http://mma.kamander.com

Jesper petersen said...

I cann't understand how to change feed link text.
Digg / All News, Videos, &
Images