Open Graph META Tags for several Share buttons

2019-04-15 00:23发布

问题:

Is there a way to have specific og meta tags for each FB share button?

<meta property="og:title" content="Youtube video 1" />
<meta property="og:description" content="First link to a youtube video" />
<meta property="og:image" content="http://www.plasticoperator.com/youtube_logo_black.png" />


<a href="http://www.facebook.com/sharer.php?u=http://www.youtube.com/watch?v=FXPXHK7I1iQ" onClick="return fbs_click(626, 305)" target="_blank" >SHARE 1</a>

    <a href="http://www.facebook.com/sharer.php?u=http://www.youtube.com/watch?v=FXPXHK7I1iQ" onClick="return fbs_click(626, 305)" target="_blank" >SHARE 2</a>

    <a href="http://www.facebook.com/sharer.php?u=http://www.youtube.com/watch?v=FXPXHK7I1iQ" onClick="return fbs_click(626, 305)" target="_blank" >SHARE 3</a>

Thank you

回答1:

No meta tags in <head>, just write it inline with sharer.php:

Updated code by Stichoza

<a
    id="fb-share"
    style='text-decoration:none;'
    type="icon_link"
    onClick="window.open(
        'http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]='
            + 'YOUR_DESCRIPTION&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE',
        'sharer',
        'toolbar=0,status=0,width=580,height=325');"
    href="javascript: void(0)"
>Share</a>