Jul 9, 201811:29 AM - edited Jul 9, 201811:30 AM
Contributor
RE: Search Results Page Design
SOLVE
Hi!
I am trying to implement HubSpot site search on a portal and I am having an issue with the search results page.
Basically, the text excerpt has a different length for each result so I would like to set a fixed length for this, in order to make the design more consistent.
Does anyone know how to edit the search results module in order to achieve this?
I haven't really had the chance to play with the new site search but I've been meaning to. I cannot seam to find any developer documentation on it, just simple instructions.
I added both the search and results module to a template then viewed source for the action menu in the design manager:
That is the markup for each module.
Here is the data from the developer info:
So my first instict would be to try to export the results module to the template context in a custom module. I would then use the pprint filter to view what data is available using a for loop. Once you have your data tokens for use in the for loop you can then use any filter on them, including truncate. That would allow you to limit the character count in the results.
I haven't tried this yet, and I would almost say it will go the way of advanced menus where you can't do what I described above, or maybe you can with advanced menus with the new design manager. I know they have updated advanced menus but I haven't had the time to really test things there either.
I always recommend using the server over the browser in these types of situation, provided it's possible. Your other option is to use some javascript, it just has to fire after the search results are loaded so it could take fractions of or whole second(s) for the results to 'snap to'. It's better than nothing though.
I haven't really had the chance to play with the new site search but I've been meaning to. I cannot seam to find any developer documentation on it, just simple instructions.
I added both the search and results module to a template then viewed source for the action menu in the design manager:
That is the markup for each module.
Here is the data from the developer info:
So my first instict would be to try to export the results module to the template context in a custom module. I would then use the pprint filter to view what data is available using a for loop. Once you have your data tokens for use in the for loop you can then use any filter on them, including truncate. That would allow you to limit the character count in the results.
I haven't tried this yet, and I would almost say it will go the way of advanced menus where you can't do what I described above, or maybe you can with advanced menus with the new design manager. I know they have updated advanced menus but I haven't had the time to really test things there either.
I always recommend using the server over the browser in these types of situation, provided it's possible. Your other option is to use some javascript, it just has to fire after the search results are loaded so it could take fractions of or whole second(s) for the results to 'snap to'. It's better than nothing though.
Let us know what you find. If you absolutely can't figure it out let me know and I will take some time to dig into it. I need to anyways so just give me a reason.