Feeds for Labels in Beta Blogger

With all the buzz over the new features in the Blogger in Beta, one thing I wondered from the start was whether there would be a feed provided for the new 'Labels'. I had kept my eyes and ears peeled for any mention of it, but haven't seen it talked about anywhere. Then yesterday I noticed a post from Pete on the Blogger Data API with a passing reference to label filtered feeds.

- [beta] rel="alternate" link for label-filtered feeds now includes the label

from 9/7 Blogger API fixes

Hmm. Label filtered feeds. Sounds like a plan. But what's the format? I haven't seen it mentioned anywhere else, so like a typical male I spend the next 30 mins trying every combination of feed name I could think of, in every CaSe. Nothing. So when all other options are exhausted, then I read the documentation. (Again, typical male eh Zo?) Which led me to this page Google Data APIs Protocol. And from there we dig down until we finally see the key.

We decided to specify a slightly unusual format for category queries. Instead of a query like the following:

http://example.com/jo?category=Fritz&category=2006

we use:

http://example.com/jo/-/Fritz/2006

This approach identifies a resource without using query parameters, and it produces cleaner URIs. We chose this approach for categories because we think that category queries will be the most common queries.

So that appears to be the key. A hyphen. So here's the format for a 'label' feed on beta.
http://beta.blogger.com/feeds/YOURBLOGID/posts/TYPE/-/LABEL
So the feed to my label feed for beta is
http://beta.blogger.com/feeds/20460175/posts/summary/-/Beta
Of course the YOURBLOGID should be your blog's id number, TYPE can be either full or summary, and LABEL is the name of the actual label you want. Also from the GDATA docs it brings up the option of including more than one category (label) in the feed. And it seems to work as expected now in beta also. So if you wanted only posts that match BOTH label 'a' and label 'b' it seems to be allowed to format it as
http://beta.blogger.com/feeds/YOURBLOGID/posts/TYPE/-/A/B

The GDATA docs also suggest that you should even be able to pass query string to the feeds, but that hasn't worked for me as of yet. Maybe I'm doing it incorrectly, or it's functionality will be added later.

For the time being I've added a simple javascript at the top of my Label Results page that points to that label's feed. I'm not sure what all else people can do with it, but it's another way to get at the data in your blog that should provide some interesting combinations.

Post a Comment

23 comments:

Ramani said...

Great find. I think they don't want to talk about label feeds until the comment feed issues are resolved. But its good to know that they do support label feeds. Avatar, where are you?

zo said...

I hereby name thee an Honorary Mac User ... on account of Mac users are constitutionally unable to RTFM until all other possiblities have been exhausted. You have to have been born this way - but I think, no prob here.

Avatar said...

i was busy.. but i saw everything and told everybody.. :D

Good find Oldman.

Improbulus said...

Great spot as usual Kirk!

Bravery Onions said...

i have two questions:

1. how do you add the link to the label's feed, on that label's page?

2. how do you add the text to search and label pages that says:

[Number] entries returned

phydeaux3 said...

@bravery onions

Both questions have basically the same answer. I've used a combination of javascript and some of they new layout conditional statements to get those.

Not really anything super complex, but what I worked up was quick and specific for my blog, so I don't know if the code is in shape for others to use. I've been meaning to take a closer look at it to possibly get it in to shape to share if others want, I just haven't had the time yet. So I may be doing that in the near future.

b o o said...

i lost all my links & graphics moving to beta. how do i make a 'link cloud' instead of a 'label cloud'? thanks in advance.

phydeaux3 said...

@b o o

Well I'm not totally sure what you mean, as the 'cloud' type setup is usually for items that have some sort of weight applied based on a number of entries...and links aren't like that..normally.

If you just want links in a dispersed togther pattern, rather than each on one line, usually a ul list set to display:inline will do it...if that answers your question. It very well may not. ;-)

Adam said...

Fantastic. Did the same as you, trawled the Blogger documentation for ages, then came across this.

Shame I didn't think to look in the API bit...

Sheta said...

Hi. I've tried finding the feeds for labels containing spaces, using the setup you provided, but it doesn't work. I've tried both leaving the spaces in, and replacing them with '%20'. Do you have any clue about how to work around this? I mean, the feeds should be out there somewhere, shouldn't they?

phydeaux3 said...

Sheta, yes, as long as you have post feeds, then you should be able to get label feeds, and for label names with spaces in them %20 is the correct character.

Also remember this article was written before they also mirrored these on blogspot.com, so for example here is the blogspot feed url for my label "Blog Notes"

http://phydeaux3.blogspot.com/feeds/
posts/default/-/Blog%20Notes

I broke it into two lines so you could see it all.

Mark said...

Thank you so much for publishing this.
I have blogger publishing to my own domain, let's say example.com, and do not have this special /feeds folder, but I can still access the feeds through the original blogspot url I set up for the site: example.blogspot.com/feeds/-/... and it even gets updated even though I am publishing via sftp!

Thanks you again so much, this really helped.

sammelsurium said...

great job!

But is it possible to use the tags of another blog?

I mean that: I have two blogs and I would like to insert your label cloud in one blog but with the labels of the second blog.

freak said...

i tried what u mentioned but it does not seems to be working fro me. It just displays the Blog Title that's it. No posts.
i tried this with my different blogs and different labels and it didnt work for any.

i used following link (splitted it in 2 lines)

http://techyfreak.blogspot.com/
feeds/posts/default/-/security

phydeaux3 said...

@freak

You are gonna kick yerself.

http://techyfreak.blogspot.com/
feeds/posts/default/-/Security

capitalize the S in Security, the labelnames have to match exactly how you enter them on your blog. :-)

freak said...

i guess i should really myself.
Thanks for the help and a wonderful solution for Label feeds :)

freak said...

i meant i shd really kick myself :)

Ben Schwabe said...

I'm having problems with labels with spaces - using %20 throws an error

The url I'm trying is http://www.blogger.com/feeds/36278947/posts/default/-/Sustainable%20and%20responsible%20tourism

And all I get is the error: bX-s8cv9

Can you help??

Thanks in advance...

freak said...

is there any way to show results belonging to two different lables?

i am not talkin baout displaying feeds belonging to 2 diff labels (that i already got an answer from ur blog).

phydeaux3 said...

@Ben

That's been a problem for only FTP blogs with spaces in the label names

It fixed itself for awhile, but appears to be back only for FTP blogs. Nothing I know to do. Report the problem to Blogger Support to let them know it's still an issue.

@freak

Combining labels is supported (an and operation) by just adding the additional label name separated by the /

ex.

feeds/posts/default/-/Javascript/Images

Would pull in labels that matched both Javascript and Images

If you mean pulling in All entries in two labels, whether they are matching or not (if you see what I'm saying) I don't think so, not yet anyway.

phydeaux3 said...

I should add on that last bit, that I don't think there is a single query that will bring in all entries from both labels...certainly it could be done with multiple requests...depending on what you are trying to do with it. Not sure if your interest is in syndication or using it with a json output or something.

Billy said...

Hi, phy, don't know if this is relevant, but I have two categories on my blog, TV and FILM. At the moment I'm using a link element for TV and a label element for FILM. Is it possible to cofigure things so that the labels for my TV posts go into the TV label element and my labels for FILM posts go into the FILM label element?

Karthik said...

Thanks for the post. It helped me

Post a Comment

Newer Post Older Post Home