Site search beta

Joseph_Baaklini
Member

Hi, About the site search beta.

I don't know if you can help me out with some technical issues

those are the questions:

-How to sort the results by language? (This example contains both English and Japanese), the language is not working, maybe its a bug on your side?

-How to get other elements from blog post in this list? (Thumbnail, Publish date, Author, etc.,)

-How to change the page HTML title?

0 Upvotes
2 Replies 2
Derek_Gervais
HubSpot Employee

Hi @Joseph_Baaklini,

  1. The &language= parameter can be included to filter results by language. This parameter should obey the ISO639-1 format (e.g. es for Spanish), so make sure that you're including the correct language code. I've included a link to a list of ISO 639-1 codes (see below).
  2. The &length= parameter specifies the length of the search results. Can be set to LONG or SHORT: SHORT will return a short highlight of the meta description, whereas LONG will build the snippet based on the html/content of the page.
  3. Are you referring to the search results page? Since the search results page is a system page, customization options are limited; it's not currently possible to customize the HTML title. I'd encourage you to create an idea on the HubSpot Community's Ideas Forum for this use case.
karinasonaglio
Contributor

Hi @Joseph_Baaklini,

 

I had the same problem a few days ago regarding the search results by languages. I solved this cloning the Site Search Input module and adding a couple of new lines in the HTML + Hubl section and also in the JavaScript one.

 

For the HTML + Hubl you can add the live above underneath the values "BLOG_POST" and "LISTING_PAGE". In this way, the search will consider also the language when searching for the results.

<input type="hidden" name="language" id="lang-search">

 

For the JavaScript you add a new function combining it. Of course you can change the values for all the languages you have in your blog. In my case, English and German.

function languageSearch() {
    if (document.documentElement.lang.includes("en")){
        document.getElementById('lang-search').value = "en";
    } else {
        document.getElementById('lang-search').value = "de"; 
    }
}

For the other two questions I guess the fastest solution would also be writing some similar functions in JavaScript using the same logic. Unfortunately, we don't have these options yet since it's a very recent feature from Hubspot.

 

I hope this helps,

Karina Sonaglio