# Search within blog posts

**URL:** <https://community.hubspot.com/t/search-within-blog-posts/16347>\
**Category:** CMS Development\
**Created:** [September 20, 2019, 5:08am UTC](https://community.hubspot.com/t/search-within-blog-posts/16347 "2019-09-20T05:08:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parul](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/parul/32/73373_2.png) [@Parul](https://community.hubspot.com/u/Parul)\
**Post date:** [September 20, 2019, 5:08am UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/1 "2019-09-20T05:08:52Z")

</div>

I want to create sub-navigation search as it is in:

> **[The HubSpot Customer Service Blog](https://blog.hubspot.com/service)**
>
> HubSpot’s blog dedicated to helping transform today’s customer service organization.

It should search only within blogs

---

<div class="post-metadata">

**Author:** ![Stephanie-OG](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stephanie-og/32/73267_2.png) [@Stephanie-OG](https://community.hubspot.com/u/Stephanie-OG)\
**Post date:** [September 20, 2019, 9:19pm UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/2 "2019-09-20T21:19:30Z")

</div>

Hi there!

If you’re using HubSpot’s default “Site Search Input” module you should see options to specify the type of content that should be included in the search results:

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/b/0b1bcd2c9393917188a216eeb6b81ca70da9bc13.jpeg)

You can also clone and customise the module further if you wanted it to only search a particular blog (if you have multiple). I wrote a short article on how to do this here: [Add parameters to your HubSpot site search input module](https://www.stephanieogaygarcia.com/hubspot-cms-development/add-parameters-to-your-hubspot-site-search-input-module?utm_source=HubSpotCommunity)

I hope that helps!

* * *

**Stephanie O’Gay Garcia**

HubSpot CMS Design & Development

[Website](http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity) | [Contact](http://www.stephanieogaygarcia.com/contact?utm_source=HubSpotCommunity)

_If this helped, please mark it as the solution to your question, thanks!_

---

<div class="post-metadata">

**Author:** ![Parul](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/parul/32/73373_2.png) [@Parul](https://community.hubspot.com/u/Parul)\
**Post date:** [October 3, 2019, 7:56am UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/3 "2019-10-03T07:56:58Z")

</div>

Hi there!  
Thanks for your solution with default “Site Search Input” module.  
But I don’t want to use it and want to create this search completely by custom code.  
So is there a way, I can search within hubspot blogs using custom code?  
Thanks,  
Parul

---

<div class="post-metadata">

**Author:** ![Stephanie-OG](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stephanie-og/32/73267_2.png) [@Stephanie-OG](https://community.hubspot.com/u/Stephanie-OG)\
**Post date:** [October 3, 2019, 12:09pm UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/4 "2019-10-03T12:09:51Z")

</div>

You should be able to copy the code from the module and use it anywhere, so something like this should work:

```auto
<form action="/{{ site_settings.content_search_results_page_path }}">
 <label for="term">Field Label</label>
 <input type="text" class="hs-search-field__input" name="term" autocomplete="off" aria-label="Field Label | Search" placeholder="Placeholder text">
</form>

```

And you can also use the additional customisations, such as only searching on the blog:

```auto
<form action="/{{ site_settings.content_search_results_page_path }}">
 <label for="term">Field Label</label>
 <input type="text" class="hs-search-field__input" name="term" autocomplete="off" aria-label="Field Label | Search" placeholder="Placeholder text">
 <input type="hidden" name="type" value="BLOG_POST">
 <input type="hidden" name="type" value="LISTING_PAGE">
</form>

```

I don’t believe there’s a HuBL module or anything else you can use instead.

* * *

**Stephanie O’Gay Garcia**

HubSpot CMS Design & Development

[Website](http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity) | [Contact](http://www.stephanieogaygarcia.com/contact?utm_source=HubSpotCommunity)

_If this helped, please mark it as the solution to your question, thanks!_

---

<div class="post-metadata">

**Author:** ![Parul](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/parul/32/73373_2.png) [@Parul](https://community.hubspot.com/u/Parul)\
**Post date:** [October 3, 2019, 12:39pm UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/5 "2019-10-03T12:39:06Z")

</div>

Thanks for reaching out 🙂  
We can do it this way and can also achieve it by implementing custom search using jQuery.  
We can use following code to call blogs in custom module and then can implement search in it.

```auto
{% set all_posts = blog_recent_posts('default', 200) %}

{% for all_post in all_posts %}
<div class="post-title"><a href="{{all_post.absolute_url}}">{{ all_post.name }}</a></div>
{% endfor %}

```

Thanks

---

<div class="post-metadata">

**Author:** ![Wlocus33](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wlocus33/32/29572_2.png) [@Wlocus33](https://community.hubspot.com/u/Wlocus33)\
**Post date:** [April 16, 2021, 12:44pm UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/6 "2021-04-16T12:44:39Z")

</div>

Once I did the export it had the primary column as a gaggle of complicated URLs (that appears to be the string of numbers you noted), but then the column next to it has the everyday name of the weblog web page itself as you can read here. I did notice that I needed to expand the columns because it was very bunched together at the start. Column B turned into the only that had the real titles of the weblog pages.

---

<div class="post-metadata">

**Author:** ![SSafi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ssafi/32/2401_2.png) [@SSafi](https://community.hubspot.com/u/SSafi)\
**Post date:** [August 25, 2021, 11:44am UTC](https://community.hubspot.com/t/search-within-blog-posts/16347/7 "2021-08-25T11:44:19Z")

</div>

Hi everyone, I know wordpress and i have built a site in it, but i have multiple pages on my site and i also need a sub navigation search, does the above codes will help me if i export them ?
