Custom Site Search - Need to Include Landing Pages in Results

Website here → www.greatamerica.com

Issue → Include Landing Pages in custom search function

On our website, there’s a custom search icon/module in the top navigation bar. I’m trying to get this search function to include Landing Pages in the Search Results. The search function is built into the code of the Header Module, so none of the Site Search documentation is helping me.

Any assistance would be helpful!

Here’s the hopefully relevant part of the module.html

<div class="grid__item portable-two-twelfths hard--ends lap-and-up-visuallyhidden">
 <div class="header--searchmobile--trigger">
 </div>
 </div>
 <div class="grid__item nine-twelfths portable-visuallyhidden hard text--left">
 <div class="grid short hard">
 <div class="grid__item one-whole hard--ends text--right">
 <div class="header--search">
 <form class="header--search--body">
 <input class="header--search--input" placeholder="{{ module.search_placeholder_text }}">
 </form>
 <span class="header--search--trigger"></span>
 </div>
 <script>
 function headerSearchSubmit() {
 if ($("body").find(".header--search").hasClass("active")) {
 if ($("body").find(".header--search--input").val()) {
 if ($("body").find(".header--search--input").val().trim().length > 0) {
 window.location.href = "{{ module.search_url_of_search_results_page.href }}?term="+$("body").find(".header--search--input").val().trim();
 }
 }
 }
 else {
 $("body").find(".header--search").addClass("active");
 }
 }
 $("body").find(".header--search .header--search--trigger").click(function (e) {
 e.preventDefault();
 headerSearchSubmit();
 });
 $("body").find(".header--search .header--search--body").submit(function (e) {
 e.preventDefault();
 headerSearchSubmit();
 });
 </script>

Might have just figured this out.

I added “type=LANDING_PAGE” to the URL part of the function.

window.location.href = "{{ module.search_url_of_search_results_page.href }}?type=LANDING_PAGE&term="+$("body").find(".header--search--input").val().trim();

Solution was based on the code I found on this Site Search post from 2018:

Hubspot also has a search API you can use, includes SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE.

Documentation here: Accounts Dashboard | HubSpot

Yes! Thank you! I knew those were the options I needed to add, I just didn’t know where to add them since this wasn’t a module itself, but a function/script written within a custom module.