元数据和社交分享

时间:2013-06-07 13:50:02

标签: javascript html5 social

我尝试使用链接配置社交分享:

<a href="https://twitter.com/share" id="twitter-wjs"><img src="img/social-twitter.png" alt="" ></a>
<a href="http://www.facebook.com/sharer.php" id="facebook-wjs"><img src="img/social-facebook.png" alt="" ></a>
<a href="https://plus.google.com/share" id="google-wjs"><img src="img/social-google+.png" alt="" ></a>
<a href="mailto:" id="mail-wjs"><img src="img/social-email.png" alt="" ></a>

然后点击事件触发javascript函数:

function openLink(event, app_name, url) {
    event.preventDefault();
    var width  = 575,
        height = 400,
        left   = ($(window).width()  - width)  / 2,
        top    = ($(window).height() - height) / 2;

    var url    = url,
        opts   = 'status=1' +
                 ',width='  + width  +
                 ',height=' + height +
                 ',top='    + top    +
                 ',left='   + left;

    window.open(url, app_name, opts);
}

$('#twitter-wjs').click(function(event) {
    openLink(event, 'twitter', this.href + "?text=" + TWITTER_TEXT);
    return false;
});

$('#facebook-wjs').click(function(event) {
    openLink(event, 'facebook', this.href + "?s=100&p[title]=" + YOUR_TITLE + "&p[summary]=" + FACEBOOK_TEXT + "&p[url]=" + YOUR_URL + "&p[images][0]=" + YOUR_IMAGE_TO_SHARE_OBJECT);
    return false;
});

$('#google-wjs').click(function(event) {
    openLink(event, 'google+', this.href + "?url=" + YOUR_URL);
    return false;
});

$('#mail-wjs').click(function(event) {
    openLink(event, 'mail', this.href + "?body=" + MAIL_TEXT + "&subject=" + YOUR_TITLE);
    return false;
});

Facebook工作正常: enter image description here

Twitter工作正常: enter image description here

邮件工作正常,但屏幕截图很无聊! ; - )

但Google+不是enter image description here

当然我跟着guidelines并添加了元数据:

<meta itemprop="name" content="Cordial en ligne" />
<meta itemprop="description" content="Cordial en ligne est un correcteur d'orthographe et de grammaire, gratuit et intelligent. Il permet de corriger vos erreurs de façon simple et pédagogique." />
<meta itemprop="image" content="http://www.cordial-enligne.fr/img/logo_social_media.png" />

<meta property="og:title" content="Dites stop aux fautes : utilisez Cordial en ligne !" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.cordial-enligne.fr" />
<meta property="og:description" content="Dites stop aux fautes sur cordial-enligne.fr. Ce service en ligne propose une correction puissante et gratuite de vos fautes d'orthographe et de grammaire !" />
<meta property="og:image" content="http://www.cordial-enligne.fr/img/logo_social_media.png" />
<link rel="image_src" href="http://www.cordial-enligne.fr/img/logo_social_media.png" />

当我尝试使用facebook对象调试器时,它运行正常:http://developers.facebook.com/tools/debug/og/object 当我从facebook添加链接到状态字段时,它工作正常。

但为什么google +不是?

0 个答案:

没有答案