# Site Search with Dynamic Pages Using Custom Objects

**URL:** <https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832>\
**Category:** CMS Development\
**Created:** [September 14, 2021, 8:48pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832 "2021-09-14T20:48:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rOsborn123](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rosborn123/32/9140_2.png) [@rOsborn123](https://community.hubspot.com/u/rOsborn123)\
**Post date:** [September 14, 2021, 8:48pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/1 "2021-09-14T20:48:55Z")

</div>

I have dynamic pages set up using custom objects as well as a site search tool. The page for my dynamic pages is set up as a Website Page, and I have “Website Pages” enabled on my site search module / tool. The path for my main listing page is “/products”. When I search for a specific product using the site search tool, rather than showing the specific detail page, the site search is just returning the general listing page.  
So, for example, when I search “history book”, rather than showing:  
History Book (/products/history-book)  
in the results from my site search, I’m instead just seeing:  
Product Listing (/products)  
What step could I be missing here to instead show the detail page of a product rather than a general listing page?

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 15, 2021, 7:46am UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/2 "2021-09-15T07:46:46Z")

</div>

Hi @rOsborn123 ,

Are you using the default site search functionality or the contentsearch API?  
Could you check if you have an [option](https://knowledge.hubspot.com/design-manager/site-search-frequently-asked-questions) to include dynamic pages in the template settings if you are using the default functionality? It currently shows nothing on dynamic pages in the docs, but it might be there.

If you are using the API, the dynamic pages should be included in the results, unless you’re blocking them with the robots.txt or have set the [&type=](https://legacydocs.hubspot.com/docs/methods/content/search-for-content) to only search within a specific page type.

---

<div class="post-metadata">

**Author:** ![rOsborn123](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rosborn123/32/9140_2.png) [@rOsborn123](https://community.hubspot.com/u/rOsborn123)\
**Post date:** [September 15, 2021, 3:10pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/3 "2021-09-15T15:10:34Z")

</div>

Thanks for the response, @Teun  
I’m attempting to use the default site search functionality, and Dynamic Pages is not an option in the template editor.  
Furthermore, I’ve attempted using the contentsearch API and am getting the same results where the listing page shows but the detail pages do not - for context, I am not supplying a type so should receive all pages that match the query regardless of page type.  
Lastly, I’ve double checked my settings and the page is not being blocked by the robots.txt

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 15, 2021, 3:21pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/4 "2021-09-15T15:21:27Z")

</div>

I’ll call in the big guns. @dennisedson is searching for dynamic pages created with a Custom Object possible using the default search functionality or the API?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [September 16, 2021, 12:36pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/5 "2021-09-16T12:36:02Z")

</div>

@rOsborn123,  
This functionality does not exist, yet. I confirmed with the team and they said that they are working on it and will let me know when it is complete, but didn’t have a firm timeline.

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 16, 2021, 12:43pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/6 "2021-09-16T12:43:26Z")

</div>

@dennisedson Thank you for the update! Good to know for future projects.

---

<div class="post-metadata">

**Author:** ![miljkovicmisa](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miljkovicmisa/32/86357_2.png) [@miljkovicmisa](https://community.hubspot.com/u/miljkovicmisa)\
**Post date:** [September 16, 2021, 7:59am UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/7 "2021-09-16T07:59:37Z")

</div>

Hello @rOsborn123 , there is also the `&pathPrefix=` query parameter, depending on how your pages are set you could use that to limit the pages returned only from a certain path, let’s say you have your dynamic pages in the url [expample.com/users/:user](http://expample.com/users/:user), you could limit your search results only to the /users path, with `&pathPrefix=users`.  
There is some documentation on how this works, [in this link](https://legacydocs.hubspot.com/docs/methods/content/search-for-content).  
You can also tweak the original search module by cloning it and then adding this query parameter in the javascript. It should be in line 80 where the `getSearchResults` function for returning results is, and there you can find the `requestUrl` variable that has a string for the query, just put `&pathPrefix=users` there and you should be good to go.

_ **If my answer was helpful please mark it as a solution.** _

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 16, 2021, 8:06am UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/8 "2021-09-16T08:06:51Z")

</div>

@rOsborn123 , this is some great advice to check if the dynamic pages are available in the search results. What happens if you change the `&pathPrefix=` to `&pathPrefix=products` ?  
Could you maybe share the URL you are searching on, we could use postman to run some tests ourselves.

---

<div class="post-metadata">

**Author:** ![rOsborn123](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rosborn123/32/9140_2.png) [@rOsborn123](https://community.hubspot.com/u/rOsborn123)\
**Post date:** [September 16, 2021, 4:45pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/9 "2021-09-16T16:45:56Z")

</div>

@Teun @miljkovicmisa Thanks for the support and advice. There seems to be something with the dynamic pages generated from custom objects that is not allowing the “/products/:product” pages to be indexed, however.  
I attempted your recommendation adding `&pathPrefix=products` in a request to the “contentsearch/v2/search” endpoint. The response returns old pages with a “/products-testing/” path in the results that pull from HubDb as well as the listing page “/products” that is leveraging the custom objects dynamic page tool, but the individual detail pages for products are not in the response.

Here’s the [URL](https://www.associatedenvironmentalsystems.com/products) of the listing page that I’m working with. To reiterate, they are not being disallowed in the robots.txt file, so I’m not sure what else may be conflicting here in regards to blocking them from being searched using the “contentsearch/v2/search” endpoint.

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 16, 2021, 5:16pm UTC](https://community.hubspot.com/t/site-search-with-dynamic-pages-using-custom-objects/43832/10 "2021-09-16T17:16:03Z")

</div>

Hi @rOsborn123 , check @dennisedson his comment. It sadly isn’t available yet. They are working on it tho.
