Labels for posts and displaying pages containing only articles with a specific label are pretty basic features for any blogging platform. But what if you want to search for several labels and retrieve articles that contain all those labels or any label? Is that even possible? I asked myself this at some point and a comment from yesterday prompted me to finally find the answer.
One of the solutions I discovered on the Blogger help forums uses search with a query in this format: <blog-URL>/search/?q=label:LABEL1+label:LABEL2. This returns posts with both labels. I tested it myself and it works, but it’s hard to manually build the URL and the search is case sensitive, meaning that it will return no results it you don’t input the label name exactly as created in Blogger.
While playing around on the blog I discovered an easier way to do this: modify the normal label URL in Blogger by adding a + sign followed by the name of the second label: <blog-URL>search/label/LABEL1+LABEL2. It’s easier to remember and to type, but it’s also case sensitive. It actually works with more than two labels – I only tested it with three, so I’m not sure if there is a limit to the number of labels you can add in the URL. I don’t use any labels with multiple words so I couldn’t test this case, but it’s safe to assume you need to escape spaces by replacing them with %20 just like Blogger does with the regular label pages.
But what about the other case, when you want to find posts with any of those labels – the OR operator instead of AND? Unfortunately the second option doesn’t seem to support OR, but the first one does: just replace the + in the search query with a vertical bar like this: <blog-URL>/search/?q=label:LABEL1|label:LABEL2. It’s fun to see this in action especially with labels that have very little to do with one another.
45 comments:
nothing working for me :'(
oh just did Thanks man you are the best !!
Works fine without "%20" to designate a space in a label with multiple words.
thanks or this! :)
yes it is awesome. its 100%working.
I had to search so many authors to learn blogger template and its complexities. But now my journey has ended as I have reached an excellent author to learn anything in Blogger. I will be commenting here of and on and seeking guidance to move forward.
Could you tell me how this will work in the case of a space in your label eg: 'Lumia 920'
I tried Lumia%20920 but that doesnt work for me
this works well, but I also wish to add something to the page via a condition. I cannot get the condition to work. Do you know how? This is what I tried:
That should work. Does the label exist?
I think the condition got stripped from the comment, but I found your question on StackOverflow. I'm not sure if Blogger supports on OR operator, so you should probably try to nest the conditions, something like:
if cond='data:blog.searchLabel == Graphics' [code]
else if cond='data:blog.searchLabel == Identity' [same code]
else if cond='data:blog.searchLabel == Brand' [same code again]
else [the other option]
Not very efficient, but unfortunately I don't see another solution...
Ok thanks.
Is there any way in searching inside a specific label. So i have a label named label 1, i need to search articles only inside the label 1 and no other articles from any other labels should come.
As far as I know there isn't, sorry...
Thanks man!
Thanks
Thanks. Works fine on my blog.
It Doesn't work with max-results=..... !!
Works fine for me! Try http://exde601e.blogspot.como/search/label/Tips+Google?max-results=7. Maybe you didn't use the exact label name?
Thank you! If works fine :)
And you can use this method to divide your posts in categories. I´ve created a new link-tipe page whose url link is a search with two labels.
Now, in my pages widget I have my blog posts divided properly :)
In:
http://inforusty.blogspot.com.es/
One of the pages is:
http://inforusty.blogspot.com.es/search/?q=label:me.sobra||label:me.falta
So thank you again :)
Thank you very much. It will be usefull.
For me too...
Not working in my blog Nanogalaxy.org
Thanks a lot. It will be usefull.
Thanks for tutorial. How t to display the results of the 10 post?
thanks for this tutorial..but how can we use it with drop down search bar.?
I'm not sure what the drop down search bar is... a search plugin for Blogger perhaps?
A user is filtering search labels from drop down menus...
Or a list box..
Hi!
I want to do a searcher that search in both post and labels. anyway to do it??
Thx
Hi,
I haven't done any extensive tests, but it seems to me that the regular Blogger search (from the toolbar on top) does precisely that.
wwoooww... that's work for me. thanks very much. so it's the parameter...;
{your blogspot address}/search/?q=label:LABEL1+label:LABEL2 >>> show ONLY label 1 "with" label 2
{your blogspot address}/search/?q=label:LABEL1|label:LABEL2 >>> show ALL thread have Label 1 "and or" label 2
:-)
I'm forgot... LABEL must be indexed.. or created a week ago, if not CAN'T WORK.
Hello! Tried in my website: http://www.infogeekcorp.com/search/label/Cr%C3%ADticas+Cinema, but it's not showing all the results :(
Tried it, it works for mine. Great help there!
How did you get it working on blogger? I tried on mine, but it doesn't work. :(
Nice Tip. It's useful for me. Thanks!
For labels with spaces in OR (|) searches, use quotes to surround the label value! For example: http://frenchdipreviews.blogspot.com/search/?q=label:%224%20of%205%22|label:%223%20of%205%22 (the %22 character is a double quote)
Thank you, I will try it.
Hope Work on my Site
http://www.cintaummahmarketing.com/search/?q=label:%22Ubat%20Herba%20Tradisional%22|label:Artikel
Thanks.
it worked for me
Thanks for information, :)
Thanks a lot
You solved my problem
thank you it's fine
Lovely post
This article is very informative and easy to understand. Thank you for sharing!
Working. Thanks.
Thanks for share!
Working for my blog Kome Cafe
Thanks, I could remove a label using negative sign -
My tests:
/search/?q=label:Wave show all Waves
/search/?q=label:Wave%20-label:Social show all Waves except who has Social too
/search/?q=label:Wave|label:Social show all Waves and all Socials but it does not show who has both
/search/?q=label:Wave+label:Social show only Waves that has Socials too
Post a Comment