<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Site Search for blogs in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12049#M1187</link>
    <description>&lt;P&gt;Looks awesome mgrubbs. Do you have a working example of this functionality?&lt;/P&gt;</description>
    <pubDate>Fri, 14 Apr 2017 16:23:35 GMT</pubDate>
    <dc:creator>tstrack</dc:creator>
    <dc:date>2017-04-14T16:23:35Z</dc:date>
    <item>
      <title>Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/11308#M1129</link>
      <description>&lt;P&gt;Is there any good we to implement Keyword search on Blog sites? I read post of usign Google Custom Search in past but as of April google stopped paid subscription for Google Custom Search and we dont want advertisement on our search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any alternative way to implement it?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 21:14:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/11308#M1129</guid>
      <dc:creator>RikinShah</dc:creator>
      <dc:date>2017-04-06T21:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/11574#M1153</link>
      <description>&lt;P&gt;Hey Rikin,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are right, as of April, Google has stopped offering their GSS and now shows advertisements if you try using their custom site search. If you are looking for alternatives to try, &lt;A href="https://www.impactbnd.com/blog/3-life-saving-alternatives-to-google-site-search" target="_self"&gt;check out&amp;nbsp;some of these&lt;/A&gt;. One of them may be an acceptable substitute to avoid ads!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Christine&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 19:03:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/11574#M1153</guid>
      <dc:creator>caustin</dc:creator>
      <dc:date>2017-04-10T19:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12023#M1184</link>
      <description>&lt;P&gt;You can use query string parameters and the &lt;A href="http://designers.hubspot.com/docs/hubl/operators-and-expression-tests#string-containing" target="_blank"&gt;&lt;STRONG&gt;"is string_containing"&lt;/STRONG&gt; expression test&lt;/A&gt;. When creating the blog content loop. To&amp;nbsp;connect a "search bar" to this search functionality, you'll need a simple form that, when submitted,&amp;nbsp;refreshes the page OR takes the user to a new "search results" page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Try something like this on your homepage:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;form action="/your-blog"&amp;gt;
    &amp;lt;input type="text" name="search" default="Search" required&amp;gt;
    &amp;lt;input type="submit" value="Submit"&amp;gt;
&amp;lt;/form&amp;gt;&lt;/PRE&gt;&lt;P&gt;The code above puts a simple form with a text box and a submit button wherever you want. When the user clicks "submit" (after adding a search term) they will be taken to yourdomain.com/your-blog (which should be your blog slug).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within your Blog Listing code (&lt;A href="http://designers.hubspot.com/docs/hubl/blog-content-markup" target="_blank"&gt;take a walk through this resource to learn more&lt;/A&gt;), find the {% for loop %} that goes through each piece of content before outputting the HTML. It will typically look like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{% for content in contents %}&lt;/PRE&gt;&lt;P&gt;The magic here is in reading the values submitted by the form from the previous page. We can use the &lt;STRONG&gt;request.query_dict&lt;/STRONG&gt; variable (see more about &lt;A href="http://designers.hubspot.com/docs/hubl/hubl-supported-variables" target="_blank"&gt;supported variables&lt;/A&gt;) to check for a "search" parameter in the URL.&lt;/P&gt;&lt;PRE&gt;{% set querys = request.query_dict %}
{% if querys.search %} {% set search = querys.search|lower %}&lt;BR /&gt;{% else %}{% set search = " " %}{% endif %}&lt;/PRE&gt;&lt;P&gt;This sets a variable = to all of the querys in the url. Ex: your form submit leads you to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="http://yourdomain.com/blog?search=fun" target="_blank"&gt;http://yourdomain.com/blog?search=fun&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The&amp;nbsp;&lt;STRONG&gt;querys&lt;/STRONG&gt; variable would now equal a dictionary of 'search': 'fun' -- you can now use querys.search to&amp;nbsp;&lt;EM&gt;directly&lt;/EM&gt; get the value "fun" for use in your comparison to the post title.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; I used the &lt;A href="http://designers.hubspot.com/docs/hubl/hubl-supported-filters#lower" target="_blank"&gt;lower filter&lt;/A&gt;&amp;nbsp;to make the search term all lowercase (this will be the same for the title of the post so we don't have case matching issues)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what the full code for your blog listing should look like:&lt;/P&gt;&lt;PRE&gt;{% set querys = request.query_dict %}
{% if querys.search %} {% set search = querys.search|lower %}{% else %}{% set search = " " %}{% endif %}
{% for content in contents %}
    {% if content.name|lower is string_containing search %}
        {{content.name}}
    {% endif %}
{% endfor %}&lt;/PRE&gt;&lt;P&gt;This full copypasta &lt;STRONG&gt;checks for a query_dict&lt;/STRONG&gt; in the URL, &lt;STRONG&gt;sets the dictionary to the search query&lt;/STRONG&gt;, &lt;STRONG&gt;loops through all blog content&lt;/STRONG&gt; in your content list, and &lt;STRONG&gt;compares the search term to the title&lt;/STRONG&gt; of the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use this functionality wherever you want really, as you can call blog_recent_posts(&amp;lt;blogid&amp;gt;,100) wherever (landing pages, blogs, website pages). So if you want to have the search bar on your&amp;nbsp;homepage and link to a "search results" page instead of a blog, you can do that as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy HubLing,&lt;/P&gt;&lt;P&gt;- Mike&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 12:35:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12023#M1184</guid>
      <dc:creator>mgrubbs</dc:creator>
      <dc:date>2017-04-14T12:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12049#M1187</link>
      <description>&lt;P&gt;Looks awesome mgrubbs. Do you have a working example of this functionality?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 16:23:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12049#M1187</guid>
      <dc:creator>tstrack</dc:creator>
      <dc:date>2017-04-14T16:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12068#M1190</link>
      <description>&lt;P&gt;I don't&amp;nbsp;have a public-facing version unfortunately - but you can very easily test it out yourself on an internal blog by adding in the HubL code (don't need the form) in the listing view of a blog and putting a ?search=word in your blog listing page when you are on the live blog url.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 18:27:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/12068#M1190</guid>
      <dc:creator>mgrubbs</dc:creator>
      <dc:date>2017-04-14T18:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/21970#M2112</link>
      <description>&lt;P&gt;This is great. With a few tweaks, I got it to work on a listing template page:&lt;/P&gt;&lt;PRE&gt;{% set querys = request.query_dict %}
{% if querys.search %} {% set search_value = querys.search|lower %}{% else %}{% set search_value = " " %}{% endif %}
{% for content in contents %}
    {% set content_searched = content.name|lower %}
    {% if content_searched is string_containing search_value %}
        {{content.name}}
    {% endif %}
{% endfor %}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;content.name|lower&lt;/STRONG&gt;&amp;nbsp;had to be stored in a variable to work in the if statement&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 19:49:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/21970#M2112</guid>
      <dc:creator>John</dc:creator>
      <dc:date>2017-07-10T19:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/33469#M3231</link>
      <description>&lt;P&gt;That would be a great feature - extended to the website itself as well!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 15:06:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/33469#M3231</guid>
      <dc:creator>clioi</dc:creator>
      <dc:date>2017-10-11T15:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/214979#M9445</link>
      <description>&lt;P&gt;Where do we put this HubL code in the blog template?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 07:09:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/214979#M9445</guid>
      <dc:creator>Shaykoo</dc:creator>
      <dc:date>2018-11-05T07:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/300928#M14224</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/5574"&gt;@mgrubbs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We used the same code, but i&lt;SPAN&gt;f we search for titles from the first three articles shown on the page, we get results. If we search for titles from articles on the succeeding page (2), we don't get any result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 15:08:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/300928#M14224</guid>
      <dc:creator>gudevsmartagent</dc:creator>
      <dc:date>2019-11-07T15:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Site Search for blogs</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/300954#M14225</link>
      <description>&lt;P&gt;Hey all, it's 2019 and now HubSpot has native &lt;A href="https://designers.hubspot.com/blog/introducing-site-search" target="_self"&gt;site search.&lt;/A&gt;&amp;nbsp;You can even narrow a search form's scope to blog posts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to fine tune it to only include one blog and exclude other blogs on a portal, then you will have to clone the module and modify it from there.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 16:22:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Site-Search-for-blogs/m-p/300954#M14225</guid>
      <dc:creator>John</dc:creator>
      <dc:date>2019-11-07T16:22:11Z</dc:date>
    </item>
  </channel>
</rss>

