Can i specify Blog's Id in Search URL as a search parameter?

karensantana
Member

Hello,

 

I'm having a lot of struggles dealing with the Search Module. I just want to retrieve blog post from only  ONE blog, not entire site. 

Can i put my blog ID in the search Url and how can accomplish that ?

Here is the function where i think it is possible to do it:

 

getSearchResults = function(){
    var searchUrl = "/_hcms/search?&term="+encodeURIComponent(searchTerm)+"&limit="+encodeURIComponent(TYPEAHEAD_LIMIT)+"&autocomplete=true&analytics=true&" + searchOptions();
    $.getJSON(searchUrl, function(data){
      if (data.results.length > 0) {
        fillSearchResults(data.results);
        trapFocus();      
      }
      else {
        emptySearchResults();
      }
    });
0 Upvotes
2 Replies 2
roisinkirby
HubSpot Product Team

Hey @karensantana can you please share a link to the blog / page(s) you are working on? @ndwilliams3 do you know if this is possible?

0 Upvotes
ndwilliams3
Key Advisor
I haven’t used the search api yet. Looking at the docs I don’t see blog Id as a parameter option. However, domain and path prefix are options, so you could Either of those to limit to a single blog.
0 Upvotes