Hacking Technique: Feeds on Front Page Only




Dear Friend,

It seems to me that the Blogger Beta team fixed the problems with comment feeds already. I tested it and it works fine. I noticed something really cool and logical too. Instead of using the blog ID (do you know off the top of your hat your site ID? I don't,) they utilize your homepage address now. So, for now my feeds are, in case anyone cares to know:

  • posts: http://hoctro.blogspot.com/feeds/posts/full

  • Comments: http://hoctro.blogspot.com/feeds/comments/full


Now, here's how I let these feeds shown (by using 2 feed widgets) on my front page only, and not my label/archived/item pages. A very simple but useful trick is employed: put an "if" check to see if the current page is the homepage or not, if so then proceed, otherwise nothing got shown.

Add two lines right inside the main includable:

* Right after the line: <b:includable id='main'>
add this line: <b:if cond='data:blog.url == data:blog.homepageUrl'>
* Right before the line: </b:includable>
add this line: </b:if>

Here is the example I put on the posts feed:


<b:widget id='Feed1' locked='false' title='Latest Posts' type='Feed'>
<b:includable id='main'>
  <b:if cond='data:blog.url == data:blog.homepageUrl'>
    <h2><data:title/></h2>
    <div class='widget-content'>
    <ul id='feedItemListDisplay'>
      <b:loop values='data:feedData.items' var='i'>
        <li>
          <span class='item-title'>
            <a expr:href='data:i.alternate.href'>
              <data:i.title/>
            </a>
          </span>
          <b:if cond='data:showItemDate'>
            <b:if cond='data:i.str_published != ""'>
              <span class='item-date'>
                 - <data:i.str_published/>
              </span>
            </b:if>
          </b:if>
          <b:if cond='data:showItemAuthor'>
            <b:if cond='data:i.author != ""'>
              <span class='item-author'>
                 - <data:i.author/>
              </span>
            </b:if>
          </b:if>
        </li>
      </b:loop>
    </ul>
    <b:include name='quickedit'/>
    </div>
    </b:if>
  </b:includable>
</b:widget>


For that purpose, any widget you want to show only on the front page you can use this trick.

Have a nice day,

Hoctro (9/2006)
Blog: http://hoctro.blogspot.com/




PS: While we're on the subject, if we don't want to see something in the front page, then just change the equal (==) check to become NOT equal (!=),

<b:if cond='data:blog.url != data:blog.homepageUrl'>