G +1按钮分享文章而不是页面



我试图让我的页面在页面上的每个帖子上都有一个+1按钮,当用户按下它时,它会分享它的内容,它的图像和名称,但每当我尝试它总是一样的,分享整个页面本身而不是文章。我知道这可以从这个答案中完成:谷歌+分享自定义文本和缩略图,从博客,家伙发布https://martinmatysiak.de/blog但是我做了同样的事情,但仍然每+1 btn只给出了页面(甚至不是我在元设置要共享的图像,而是加载图像。我有以下代码:

    <article class="topicWrapper" name="topicWrapper69" itemscope="" itemtype="http://schema.org/BlogPosting">
    <img src="http://bluebit.nu/whatIf/img/logo.png" itemprop="image" style="display:none;">
    <div class="topic" itemprop="name" style="display:none;">What If - Think and Socialize</div>
    <div class="topic" itemprop="description">asd</div>
    <div id="comments" name="comments69" style="display: block;">
        <div class="comment" name="comment46">
            <img src="" width="15px" height="15px" id="id_image">asdqwe</div>
        <div class="comment" name="comment48">
            <img src="" width="15px" height="15px" id="id_image">qwe</div>
    </div>
    <div id="bottom_topic_content" name="bottom_content69">
        <div id="more_image" name="more_image69" class="unclicked" onclick="handleMoreComments(this)">+</div>
        <button id="comment_button" onclick="commentButton(this)" name="comment69">comment</button>
        <img src="img/share.png" id="share_button" name="share69">
        <img src="" id="tweet_button" name="tweet69">
        <div id="around_google">
            <div id="___plusone_0" style="text-indent: 0px; margin: 0px; padding: 0px; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 450px; height: 24px; background: transparent;">
                <iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 450px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 24px;" tabindex="0" vspace="0" width="100%" id="I0_1406032246840" name="I0_1406032246840" src="https://apis.google.com/u/0/_/+1/fastbutton?usegapi=1&amp;annotation=inline&amp;origin=http%3A%2F%2Fbluebit.nu&amp;url=http%3A%2F%2Fbluebit.nu%2FwhatIf%2F&amp;gsrc=3p&amp;jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.7k04nU8yQ54.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Ft%3Dzcms%2Frs%3DAItRSTO56KSreBGyp88HYuxObmZZTQr2eA#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh&amp;id=I0_1406032246840&amp;parent=http%3A%2F%2Fbluebit.nu&amp;pfname=&amp;rpctoken=25567491" data-gapiattached="true" title="+1"></iframe>
            </div>
        </div>
        <!-- load google api -->
        <!-- end google api load -->
        <img src="" id="pinterest_button" name="pinterest69">
    </div>
    <div id="post_comment_content" name="post_comment_content69">
        <img src="" id="new_post_img">
        <input type="text" id="comment_input" name="comment_input69" class="comment_input69" onkeyup="commentPressed(event,this)">
        <button type="submit" id="comment_cancel" onclick="commentButton(this)" name="comment_cancel69">X</button>
        <button type="submit" id="comment_submit" onclick="commentButton(this)" name="comment_submit69">post</button>
    </div>
</article>

包含itemscope、itemtypes和按钮本身。有人知道吗?一些我需要预设的设置或其他东西使其工作?

在单个html页面中尝试此链接,然后自定义参数url

<html>
    <head>
        <title>Demo: Explicit render of a +1 button</title>
    </head>
    <body>
        <a
            href="https://plus.google.com/share?url=http://stackoverflow.com/questions/24887668/g1-button-share-article-not-page?noredirect=1#comment38659884_24887668"
            onclick="
                    javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');
                    return false;">
            <img src="https://www.gstatic.com/images/icons/gplus-64.png"
                 alt="Share on Google+"/></a>
    </body>
</html>

最新更新