Add priority for meta description in Metadata Mapping

In Metadata Mapping by default " C " for description metadata mapping with list of metadata tags like below,

dc.description
DCTERMS.description
description
og:description
twitter:description

How we can add priority for this list, Like if the web page have twitter:description and description metadata, I like to give more priority to twitter:description displaying in search result summary.

There isn’t a way currently to apply a priority.

If you know that your description is in a particular field I would suggest adjusting the metadata mappings and either remove the fields that you don’t use, or map the field that you are interested in to a separate metadata field (e.g. searchDescription) then use this in your search results template.

If you must assign a priority you’ll need to map each metadata field to a separate class and then use conditional logic in your template to handle the order of display.

e.g.

<#if s.result.metaData["twitterDescription"]??>
${s.result.metaData["twitterDescription"]}
<#elseif  s.result.metaData["ogDescription"]??>
${s.result.metaData["ogDescription"]}
<#else>
${s.result.summary}
</#if>
2 Likes

Out of curiosity, why are you using different descriptions for each type?

Hello,

Not using different description, trying to give weight or priority for description. Like if the page have meta description, twitter description. I like give priority meta description over twitter description.

Thanks,
Gnana