Adobe Search and Promote reading Open Graph tags (og:tag)


Adobe Search and Promote won't allow adding meta tags having special characters (:, % etc) and if we want to read meta property values added in open graph tags (used for social network sites) then it can be achieved by filtering script and add it to a custom meta tag on the page

Steps:

1) Login to Adobe Search and Promote console
2) Select account of corresponding site
3) Go to Settings --> Filtering --> Filtering Script (This is the place where you can update the page content before Search and Promote reading page details)
4) Add below code 

undef $/;

my $doc = <>;

if ($doc) {

if( $doc =~ m{<meta property="og:image" content="(.*?)"}is) {
      my $imageVal = $1
      $doc =~ s{</head>}{<meta name="customproperty" content="$imageVal" />\n</head>}i;
}

print $doc;

}

return 1;

5) Above code adds meta tag of customproperty on the pages where og:image meta property is present and customproperty now can be used in presentation template to display on the search result page

Comments

Popular posts from this blog

AEM integration with Akamai Fast Purge API for Single/multiple urls

AEM Results count using query builder

AEM - Rollout a page programmatically and update references