APIs & Integrations

BNunes
Member

How can I combine primary and sub domain search results?

SOLVE

We currently have a our web pages on our primary domain and our blog posts on a subdomain within hubspot.  Currently the search only give results for matches in that particular domain.

 

Example:

Search for "PCI Compliance" only returns matches that are website pages

Search for "PCI Compliance" only returns matches that exist in blog pages

 

I would like to have my search results include both no matter if you are on the web pages or blogs.

 

I know enough to edit code and modules, but I am not a developer.  Can anyone guide me on how to accomplish this?

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

How can I combine primary and sub domain search results?

SOLVE

Welcome, @BNunes.

 

These types of questions are generally better posted on the CMS Development board, but I'm happy to help point you in the right direction.

 

Are you using the default Site Search Input module? If so, that module only includes results hosted on the same subdomain. This likely explains why you're only seeing web pages when searching on your primary domain and blog posts when searching on your blog subdomain.

 

To include results from across your site, you'll have to clone the Site Search Input module and modify its source code with these customization options. Notably, the type and domain filters should be as inclusive as possible. To my knowledge, the cloned Site Search Input module's JavaScript will have to be modified to accomodate these customizations. For example, line 57, where the requestUrl is defined should be modified to the v2 endpoint defined in our documentation.

 

If you need additional assistance setting this up, would you mind posting on the CMS Development board as well? Feel free to tag me so I can keep an eye on it.

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
4 Replies 4
BNunes
Member

How can I combine primary and sub domain search results?

SOLVE

Can anyone help with this or is it posted in the wrong place?

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

How can I combine primary and sub domain search results?

SOLVE

Welcome, @BNunes.

 

These types of questions are generally better posted on the CMS Development board, but I'm happy to help point you in the right direction.

 

Are you using the default Site Search Input module? If so, that module only includes results hosted on the same subdomain. This likely explains why you're only seeing web pages when searching on your primary domain and blog posts when searching on your blog subdomain.

 

To include results from across your site, you'll have to clone the Site Search Input module and modify its source code with these customization options. Notably, the type and domain filters should be as inclusive as possible. To my knowledge, the cloned Site Search Input module's JavaScript will have to be modified to accomodate these customizations. For example, line 57, where the requestUrl is defined should be modified to the v2 endpoint defined in our documentation.

 

If you need additional assistance setting this up, would you mind posting on the CMS Development board as well? Feel free to tag me so I can keep an eye on it.

Isaac Takushi

Associate Certification Manager
0 Upvotes
jk-sone
Participant

How can I combine primary and sub domain search results?

SOLVE

First of all, this answer is out of date -- HubSpot newest Site Search API documentation is available here: https://developers.hubspot.com/docs/api/cms/site-search

Secondly, why would say a question about searching a blog subdomain on HubSpot would be better posted to the CMS Developers board? Last I looked, Blogs and Landing pages are two different things on HubSpot and, more importantly, Site Search, which would appear to be the solution this person wants to implement, is very much a part of HubSpot's API, not its content management.

We have a similar issue, though given that someone else with a similar issue is waiting some three years for a reply doesn't give me much hope for one, myself. But hopefully my optimism will be rewarded with a working solution. 

We want something that is reasonably embeddable the way HubSpot's forms are. Our scenario:

- we have a main ecommerce site (let's call it ecommerce.com);
- we have a HubSpot site/subdomain we host landing pages on (let's call it marketing.ecommerce.com);

- we want a Site Search Input component embedded and available on ecommerce.com to search content and return results from the subdomain marketing.eceommerce.com.

Is that possible with simple embed code like HS forms? A cURL/Node/&c. solution will not be possible on our ecommerce site, but a vanilla JavaScript solution might be. Please let us know if this is possible and thanks.

0 Upvotes
amandablum
Member

How can I combine primary and sub domain search results?

SOLVE

Issac we're also struggling with this. We are using enterprise and our blog and landing pages are on Hubspot (email. and resources. respectively), but our primary domain is hosted elsewhere in WP. We've been struggling with how this will affect search on our site (how can we include blog results) and on Hubspot (how can we include site pages).  We're not using the Hubspot CMS, so I wanted some clarity around this topic.  

0 Upvotes