Closed finnlewis closed 1 year ago
@markconroy @msayoung @richard-s-rowley @willguv
Any thoughts on how to define consistent display modes for search results?
I'm a big fan of single templates for single view modes that can then be used across all content types. So ... my preference - same as teaser, card, etc - would be to have a template in localgov_base
called node--search-result.html.twig
and we put the layout in there. Then all content types will have the same layout.
If a content type in a module has a more specific template - like node--event--search-result.html.twig
we can easily create the same template in our theme and set it to {% include <our-theme-template>html.twig %} (like we are doing with
node--news--teaser.html.twig`
P.S. Those Waltham Forest search results look really nice.
Worth noting the WF live version are fields output not entity output; but the module they supplied does suggest method for the same using entity output. The bigger part there being making the view modes for search results with the custom output (eg. Services landing pages highlighting particular listed pages).
I've created an issue in each project that provides a content type, so we can address each there and perhaps get help from others,
We've currently got this template - https://github.com/localgovdrupal/localgov_base/blob/1.x/templates/content/node--search-result.html.twig - for node--search-result.html.twig
, but it's just a very basic node template.
It would be worth laying it out something like our teaser template - image left, title/content on right or similar.
We currently have no consistent display for search results in LocalGov Drupal
https://demo.localgovdrupal.org/search?s=council
We need to
Work from Waltham Forest might be useful, at least for LocalGov Services.
See https://www.walthamforest.gov.uk/search?search=birth