0

I try to add open graph object in my php site but having issue because i use jQuery append function to dynamically update all pages title & description but facebook opengraph object debugger not read this

$('head').append('<meta property="og:title" content="'+MetaData[0]['coup_meta_title']+'" />');

above is my code example

Atranaz
  • 3
  • 2
  • I don't think the Facebook spider processes JavaScript, hence the problem. Is there a reason why you can't place this directly in the HTML? – Rory McCrossan Dec 21 '15 at 13:44
  • @RoryMcCrossan because i have lots of dynamic pages and i get all data via ajax request – Atranaz Dec 21 '15 at 13:49

1 Answers1

0

Here are few things that will help you

  • Much like search engine crawlers, the Facebook scraper does not execute scripts so whatever meta tags are present when the page is downloaded are the meta tags that are used. see here for related stuff (How does Facebook Sharer select Images and other metadata when sharing my URL?)
  • If you consider appending/specifying your og meta tags to head tag from your server side code instead of doing it from javascript it will solve your problem.
Community
  • 1
  • 1
Ashutosh
  • 199
  • 1
  • 12