Skip to content

Commit

Permalink
Merge pull request #142 from City-of-Helsinki/UHF-X_test_linkedin_fix
Browse files Browse the repository at this point in the history
Added prefix to og tags for linkedin
  • Loading branch information
rpnykanen authored Dec 8, 2022
2 parents 695870a + 980d7ca commit 5c49d06
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,16 @@ function helfi_rekry_content_preprocess_block(&$variables) {
}
}
}

/**
* Implements hook_page_attachments_alter().
*/
function helfi_rekry_content_page_attachments_alter(array &$attachments) {
$og_tags = ['og_site_name', 'og_url', 'og_title', 'og_image_0'];

foreach ($attachments["#attached"]["html_head"] as $key => $attachment) {
if (isset($attachment[1]) && in_array($attachment[1], $og_tags)) {
$attachments["#attached"]["html_head"][$key][0]['#attributes']['prefix'] = 'og: http://ogp.me/ns#';
}
}
}

0 comments on commit 5c49d06

Please sign in to comment.