CMS Development

Woodsy
Top Contributor

Blog Search

SOLVE

How do I add a search to my blog? I have found this article https://community.hubspot.com/t5/COS-Design-Support/Site-Search-for-blogs/m-p/11308 which gives a rough idea on how to implement a search.

 

The first part of my listing code looks like this:


<div class="row same-height-parent isotope" style="display:flex; flex-wrap:wrap;">
{% for content in contents %}
<div class="span4 resource-listing-thumb">
{% if content.widgets.new.body.value == 'new' %}
<div class="new-banner"></div>
{% endif %}
<div class="hs-featured-image-wrapper" style="width:100%">
<a href="{{content.absolute_url}}" title="" class="hs-featured-image-link">
<img src="{{content.post_list_summary_featured_image }}" class="hs-featured-image">
<h4>{{content.name }}</h4
</a>
</div>
</div>
{% endfor %}
</div>

 

How do I adapt this code so that my search field pulls the relevent blogs in?

 

 

0 Upvotes
1 Accepted solution
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Blog Search

SOLVE

@Woodsy try following this post on how to build a hubspot blog search. Then let me know if you have any questions 🙂

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

4 Replies 4
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Blog Search

SOLVE

@Woodsy try following this post on how to build a hubspot blog search. Then let me know if you have any questions 🙂

Stefen Phelps, Community Champion, Kelp Web Developer
MarkDBF
Participant | Diamond Partner
Participant | Diamond Partner

Blog Search

SOLVE

Hi Stefen,

 

I checked out this link a month ago, and it looked awesome and simple. Now, I've come back to implement and the link is broken. Do you have any suggestions about where else I could find a similar description please?

Woodsy
Top Contributor

Blog Search

SOLVE

Thanks Stefen, Do I need to create a new site page / landing page? Could the search repopulate the blog listing in the same way that the topic list toggle does? If I have to create a seperate page is there any way to clone the blog listing page and save it as a new site page / landing page?

0 Upvotes
stefen
Key Advisor | Partner
Key Advisor | Partner

Blog Search

SOLVE

@Woodsy that's how I've done it. But I suppose you could build it into the regular blog listing template with an if statement checking for the query.

Stefen Phelps, Community Champion, Kelp Web Developer
0 Upvotes