开发者

Tweet counter only shows more than 0 on root page?

开发者 https://www.devze.com 2023-03-19 14:27 出处:网络
I have the twitter button on the top of my page using the following code in my header file: <script src=\"http://platform.twitter.com/widgets.js\" type=\"text/javascript\"></script>

I have the twitter button on the top of my page using the following code in my header file:

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitte开发者_运维技巧r.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a>

However, the count only shows the number of tweets we have on the root page, i.e., www.website.com. www.website.com/anything does not show a tweet count other than 0.

Does anyone have any solutions for this? Thanks in advance.


To always use the root page, add the data-url attribute to the anchor tag.

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="http://www.website.com">Tweet</a>

Check out the Tweet button documentation for more options.

0

精彩评论

暂无评论...
验证码 换一张
取 消