Hi team,
Is it possible to specify the vertical on the iframed result page when searched from the Answers Search bar? The expected move is to transition to the specified vertical when searched from the search bar. Here’s what I meant to see when searched from search bar (not universal, but specified product vertical).
It seems possible by specifying 2 parameters (redirecturl and verticalkey) when it’s NOT an iframed result page, as an attached image.
But iframed vertical result page does not have a unique URL (it only specifies vertical by a parameter such as ?verticalUrl=products.html), so the expected transition did not happen when specified as below.
Do you have any idea on how to configure it?
Many thanks,
Kaishi
Hi Kaishi,
Following this previous Community post where DJ was able to get the search bar to direct to a vertical, I believe you just need to have the verticalUrl
URL parameter for redirectUrl
and you don’t need the verticalKey
parameter.
Additionally, I just want to be sure for [[domainname]]
you are using the search results page URL and not the main domain URL. For example, this https://www.yext.com/answers?verticalUrl=products.html
, not https://www.yext.com?verticalUrl=products.html
without the answers.
Can you see if this works for you?
Hi Kirsty, thank you so much for your reply. Unfortunately, if I implement as you advised, the search term is not handed over to the search result page.
We have tested some functions and below should be the best solution for this.
ANSWERS.addComponent("SearchBar", {
container: ".search_form",
name: "search-bar",
redirectUrl: "[[URL]]",
placeholderText: "Search",
submitIcon: "magnifying_glass",
onMount() {
// Example
// this.core.storage.setWithPersist('verticalUrl', 'faqs.html');
this.core.storage.setWithPersist('verticalUrl', '[[Vertical HTML name]]');
}
});
Hi Kaishi,
Glad you were able to figure it out. This will be a helpful resource for others who are trying to do the same thing!