Assuming you only want to parse the returned term and not lookup alternate labels and such you can use the built-in $getItemValue
function. It takes the context and the mapped name of your managed property:
$getItemValue(ctx, mappedManagedProperty')
The mapping is the name you specify in the ManagedPropertyMapping
attribute within the display template. Say your display template specified these mappings:
<mso:ManagedPropertyMapping msdt:dt="string">
'Title':'Title',
'Path':'Path',
'Description':'Description',
'EditorOWSUSER':'EditorOWSUSER',
'LastModifiedTime':'LastModifiedTime',
'CollapsingStatus':'CollapsingStatus',
'DocId':'DocId',
'HitHighlightedSummary':'HitHighlightedSummary',
'HitHighlightedProperties':'HitHighlightedProperties',
'FileExtension':'FileExtension',
'ViewsLifeTime':'ViewsLifeTime',
'ParentLink':'ParentLink',
'FileType':'FileType',
'IsContainer':'IsContainer',
'SecondaryFileExtension':'SecondaryFileExtension',
'DisplayAuthor':'DisplayAuthor',
'ServerRedirectedURL':'ServerRedirectedURL'
'Subject': 'owstaxIdSubject'
</mso:ManagedPropertyMapping>
Where owstaxIdSubject
is a taxonomy field managed property with a value like so:
"SharePoint|#f76c1099-c0e6-f6df-7814-cc7ea541b129
You would write this:
$getItemValue(ctx, 'Subject')
to render something like this:
SharePoint