Monday, March 15, 2010

Blogger Magic - Detecting The Blog Feed

Ever see a magician take a pack of playing cards, shuffle the deck, wave his wand over the deck, and make the Ace of Spades rise into the air? Pretty mysterious.

How about I wave my wand over my blog, and make the blog feed URL rise into your browser? You've seen a BlogList wizard - you add a blog to your bloglist. Just type in the blog URL, and it pops up the feed. How did it do that?

The answer isn't hard to see, just look in the template header, for the live blog. Use View - "Page Source" with the blog displayed in your browser, or use an HTTP text proxy, to examine the blog code.

Here's the header for this blog.
<head>

...

<link href='http://blogging.nitecruzr.net/' rel='canonical'/>
<link rel="alternate" type="application/atom+xml" 
title="The Real Blogger Status - Atom"
href="http://blogging.nitecruzr.net/feeds/posts/default" />
<link rel="alternate" type="application/rss+xml"
title="The Real Blogger Status - RSS"
href="http://blogging.nitecruzr.net/feeds/posts/default?alt=rss" />
<link rel="service.post" type="application/atom+xml" title="The Real Blogger Status - Atom" href="http://www.blogger.com/feeds/24069595/posts/default" />

...

</style>

There it is
http://blogging.nitecruzr.net/feeds/posts/default

You won't see anything from the template source, in "Page Elements" - "Edit HTML". You have to look at the live, rendered HTML.

Here's what you may see, in "Edit HTML".
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<meta content='width=1100' name='viewport'/>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>

Not all third party templates will include the crucial code snippet:
<b:include data='blog' name='all-head-content'/>

If your template is missing that line of code, no magic for you.

Now, consider possible additional details which some folks have - both a custom domain redirect, and a custom feed (ala FeedBurner) redirect, may provide more challenge.

Also note that the URL shown in the header displays the native URL of the feed - and reflects the value of the internal feed URL variable. If you change this header record, that won't change the internal variable. To change the URL, you need to setup a redirected feed (such as a FeedBurner feed) - then use the Post Feed Redirect setting, to point to the redirected feed.

You do know, I hope, that if your blog is private, it will not publish a feed. And finally, be aware that not all online services accept a redirected feed.

It's not really magic, once you understand the details.

>> Top

3 comments:

Kyle and Svet Keeton said...

Thank you for your tip... That is very useful!!!

But I know that for some blogs Blogger generate all this link-type records and for some it did not generate them.

Yes, that's a very good idea just add these link type records by yourself in template, but more interesting question is What I need to add to template to make Blogger generate these links for me?

Best regards!
Svetlana

Kyle and Svet Keeton said...

Just found an answer on my previous question. To make Blogger to generate all these if we use <b:include data='blog' name='all-head-content'/> in head-part.

Regards,
Svetlana

Dudel said...

Yeah I have friends with this problem on a LOT of their stuff. I think I'm going to link them to this page so they can fix it.