Use Blogger Page links as label filter

In blogger, when user desires to add the link of posts specific to label in the page navigation.
Use the below code in the page html, enclosed with the script tag.

Change the URL as per requirements. Whenever user clicks on the page link it will redirect to the specific label filter page specified in the script. It also handles mobile layouts too.



function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}
if(getQuerystring('m'))
window.location="http://www.YourBlog.com/search/label/DESIREDLABEL/?m=1";
else
window.location="http://www.YourBlog.com/search/label/DESIREDLABEL";

Comments

  1. This is awesome. Exactly what I wanted. Thanks!

    ReplyDelete
  2. Will this take the category of the home page? That's what I want to achieve.

    ReplyDelete
  3. Hi Rajesh, I'm looking for something like this, but I'm having a hard time without better JS knowledge. Is there a way I can make this script add or remove labels from the URL, so I can get feeds for a combination of tags? Blogger accepts these URLs like this one: http://dorianredesignstheworld.blogspot.ca/search/label/web%20design+usability+internet%20culture

    I described what I want to do in more detail here: http://dorianredesignstheworld.blogspot.ca/2013/04/filtering-blogger-posts-using-multiple.html

    ReplyDelete
  4. Demo please. Thank You!

    regards
    JelBee

    ReplyDelete
  5. THANKYOU SO MUCH FOR THIS!

    ReplyDelete
  6. I have created a blog with blogger for distributing free templates - https://templatemonstrosity.blogspot.in But the thing is that I need to make it easier for my readers to search through my posts. I have a lot of labels and I think that it would b great if someone can help me to make a filterer like the one right here https://btemplates.com/template-search/. BTW. I am a complete beginner and it would be great if you make it easy to understand. Thanks.

    ReplyDelete

Post a Comment