pnp / sp-dev-solutions

Repository for SharePoint development reusable solutions
Other
500 stars 442 forks source link

Additional Question on how to render links in search results #592

Open woscheer opened 1 year ago

woscheer commented 1 year ago

Category

Expected or Desired Behavior

I have an additional question to #374: A list contains a hyperlink Site Column and i would like to reference the hyperlinks decription (title) in the template of the pnp search result Webpart.

Observed Behavior

The Site Column in this case is mapped to the the managed property 'RefinableString06' which is now a string representation of the hyperlink, but the title (or description) part is missing, what can be verified in the debug view (the slot name is called 'InfoLink', and the url part of the hyperlink is rendered correctly in the search results): "RefinableString06": "https://<tenant>.sharepoint.com/:b:/r/sites/<site>/Dokumentearchiv/CoCDeutschSept2023.pdf?csf=1&web=1&e=HQCRsv",

Debug View of RefinableString06:

pnpsearch01

List Setting of InfoLink:

pnpsearch02

Managed property Setting:

pnpsearch03

Search Result:

pnpsearch04

I have tried to use {{getUrlField RefinableString06OWSURLH "Title"}} or {{getUrlField RefinableString06 "Title"}} but i always get 'undefined' for the title in the search results. I think the reason is because my RefinableString06 has somehow lost the description part of the url, because there is no comma to split the url and the title part in the RefinableString06.

Is there something I have missed? How can i display the Title or Description part of the url field?

Thank in advance!

Steps to Reproduce

Create a Hyperlink Site Column and add it to a list, map the crawled property to a managed property like 'RefinableString06'

Thanks in advance

wobba commented 1 year ago

If this is related to the PnP modern search web part, ask your question at https://github.com/microsoft-search/pnp-modern-search/discussions