gpt4 book ai didi

html - 条件标签不起作用

转载 作者:行者123 更新时间:2023-11-28 06:44:57 25 4
gpt4 key购买 nike

我为我的分享按钮编写了一个条件标签。我希望共享按钮出现在除了静态页面之外的任何地方——所以博客的页面元素。我添加了以下条件标记来实现上述效果:

<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='&quot;https://twitter.com/share?url=&quot; + data:post.url + &quot;&amp;title=&quot; + 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='&quot;mailto:?subject=&quot; + data:post.title + &quot;&amp;body=&quot; + 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='&quot;http://www.facebook.com/sharer.php?u=&quot; + data:post.url + &quot;&amp;t=&quot; + 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

最佳答案

听起来您只想在帖子中显示社交分享按钮。因此,如果是,那么您必须更改条件代码:

<b:if cond='data:blog.pageType == "item"'>
<div class='sharebtns'>
<a class='twitter' expr:href='&quot;https://twitter.com/share?url=&quot; + data:post.url + &quot;&amp;title=&quot; + 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='&quot;mailto:?subject=&quot; + data:post.title + &quot;&amp;body=&quot; + 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='&quot;http://www.facebook.com/sharer.php?u=&quot; + data:post.url + &quot;&amp;t=&quot; + 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>

结果是显示帖子的社交分享按钮。

关于html - 条件标签不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34095914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com