I am creating a website in which Facebook's share and like buttons are attached.
I want to know if I can change og:description
, og:title
, og:author
etc. dynamically using PHP?
For example:
<meta property="og:url" content="<?php echo my_url(); ?>"/>
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php echo $random_title; ?>"/>
<meta property="og:author" content="<?php echo $random_author; ?>"/>
<meta property="og:description" content="<?php echo $random_desc; ?>"/>
These description, title, author are different for different posts. So can I do it in this way ? Or is there any other way ?
I have got the error when i debug the URL with https://developers.facebook.com/tools/debug/
Extraneous Property Objects of this type do not allow properties named 'og:author'.
Parser Mismatched Metadata The parser's result for this metadata did not match the input metadata. Likely, this was caused by the data being ordered in an unexpected way, multiple values being given for a property only expecting a single value, or property values for a given property being mismatched. Here are the input properties that were not seen in the parsed result: 'og:author'