我试图隐藏所有贴有标签的帖子" Master Gardener"
我已经使用过这段代码而且它有效,但我找不到带有标签" Master Gardener"的帖子。这篇文章只有一个标签。这是网站http://upcommunitygarden.blogspot.com/
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast == "true"'>
<b:if cond='data:label.name != "Education""Projects"'>
<b:include data='post' name='post' />
</b:if>
</b:if>
</b:loop>
<b:else/>
<b:include data='post' name='post' />
</b:if>
&#13;
答案 0 :(得分:0)
使用data:post.labels.length == "1"
检查帖子是否有一个标签
<b:if cond='data:blog.url == data:blog.homepageUrl and data:post.labels.length == "1"'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name != "Master Gardener"'>
<b:include data='post' name='post' />
</b:if>
</b:loop>
<b:else/>
<b:include data='post' name='post' />
</b:if>
答案 1 :(得分:0)
你的代码不好。
替换:
<b:loop values='data:posts' var='post'>
by:
<b:loop values='data:view.isMultipleItems ? data:posts where (p => p.labels none (l => l.name in {"Education","Projects"})) : data:posts' var='post'>