我为分享按钮编写了一个条件标签。我希望共享按钮在静态页面中随处可见 - 所以博客的页面元素。我添加了以下条件标记来实现上述影响:
<b:if cond='data:blog.pageType != "static_page"'> The share button coding here </b:if>
我按照本教程的说明 - http://icanbuildablog.com/2015/03/blogger-conditional-tags/ - 非常仔细地确保在应用条件标签时不会出错,但现在共享按钮只显示在项目页面上 - 单个博客帖子。
我已将我插入模板中的完整编码包含在下方:
<b:if cond='data:blog.pageType != "static_page"'>
<div class='sharebtns'>
<a class='twitter' expr:href='"https://twitter.com/share?url=" + data:post.url + "&title=" + data:post.title' rel='nofollow' target='_blank' title='Tweet This'><img alt='Tweet This' border='0' height='25px' src='http://i1379.photobucket.com/albums/ah140/mynamesiram/Mobile%20Uploads/A036F9A7-1B42-42A6-9DF4-29FE498F231D_zpshfhfvks2.jpg' width='25px'/></a>
<a class='email' expr:href='"mailto:?subject=" + data:post.title + "&body=" + data:post.url' rel='nofollow' target='_blank' title='Share Via Email'><img alt='Share Via Email' border='0' height='25px' src='http://i1379.photobucket.com/albums/ah140/mynamesiram/Mobile%20Uploads/45AA973D-D8A1-4FAE-A31A-138DA7CB8443_zpsteklwczz.jpg' width='25px'/></a>
<a class='facebook' expr:href='"http://www.facebook.com/sharer.php?u=" + data:post.url + "&t=" + data:post.title' rel='nofollow' target='_blank' title='Share This On Facebook'><img alt='Facebook Share' border='0' height='25px' src='http://i1379.photobucket.com/albums/ah140/mynamesiram/Mobile%20Uploads/234A9CED-06E8-4D0B-8377-A64D92B082A1_zpsbexuli8g.jpg' width='25px'/></a>
<a class='comment-form' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick.com' title='comment-form'><img alt='comment-form' border='0' height='25px' src='http://i1379.photobucket.com/albums/ah140/mynamesiram/Mobile%20Uploads/F698C5CF-D64E-4C9D-B8DA-AC431C5B343E_zpsvpxnfbuv.jpg' width='25px'/></a>
</div></b:if>
我博客的网址如下:http://www.blankesque.com
答案 0 :(得分:0)
听起来您只想在帖子中显示社交分享按钮。所以如果是,那么你要改变条件代码:
var itemPrices = {};
itemPrices[1] = {};
itemPrices[1][1] = 1000;
itemPrices[1][2] = 2000;
itemPrices[2] = {};
itemPrices[2][1] = 1000;
itemPrices[2][2] = 2000;
这将显示帖子的社交分享按钮。