Guest User

Untitled

a guest
Mar 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function template_preprocess_my_detail_page(&$variables) {
  2.  
  3. $items = $variables['item'];
  4.  
  5. $title = $items->title;
  6.  
  7. $og_title = [
  8. '#tag' => 'meta',
  9. '#attributes' => [
  10. 'property' => 'og:title',
  11. 'content' => $title,
  12. ],
  13. ];
  14.  
  15. $variables['page']['#attached']['html_head'][] = [$og_title, 'og_title'];
  16. }
  17.  
  18. function MY_MODULE_page_attachments_alter(array &$page) {
  19.  
  20. $og_title = [
  21. '#tag' => 'meta',
  22. '#attributes' => [
  23. 'property' => 'og:title',
  24. 'content' => '',
  25. ],
  26. ];
  27.  
  28.  
  29. $page['#attached']['html_head'][] = [$og_title, 'og_title'];
  30. }
Add Comment
Please, Sign In to add comment