PnP modern search handlbars template extract name only from the _AuthorByline field?

matt howell 351 Reputation points
2022-08-04T20:30:37.817+00:00

I'm using Pnp modern search results web part to display news posts and news links from multiple sites and have created a handlebars template to mimic the rendering of the news.aspx page. I've mapped the RefinableString05 managed property to the ows_q_USER__AuthorByline crawled property, which returns and array like:
xxx@X .com | lastname, firstname | xxxx32323837314076657269736B2E636F6D i:0#.f|membership|ixxx@X .com
How do I display ONLY the "lastname, firstname" part?

Microsoft 365 and Office | SharePoint | For business | Windows
{count} vote

2 answers

Sort by: Most helpful
  1. Jinwei Li-MSFT 4,736 Reputation points Microsoft External Staff
    2022-08-10T09:59:22.777+00:00

    Dear @matt howell ,

    Hope you to have a good day.
    Thanks for your detailed explanation, I am more than willing to help you out. However, currently the questions about Microsoft-search are not supported in Q&A forum.

    You could raise a new thread in the Microsoft-search forum to get better support.

    I hope I can offer you a better experience next time if I have a chance to work with you again.

    Yours faithfully.
    Jinwei Li


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. matt howell 351 Reputation points
    2022-08-10T13:25:38.473+00:00

    Actually, this isn't a question for the PnP search forum - the search functionality works fine - it's a question about out of the box managed properties, and how to extract a value from them. So maybe someone else can chime in here. I did find mapping ows__AuthorByline to a managed property gives just the name value, but still it would be good to get an answer for how to extract values, since Msft's documentation is so woefully inadequate.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.