如何在Google Blogger中隐藏主页上具有特定标签的所有帖子? [英] How to hide all post's having certain labels on home page in Google Blogger?

查看:90
本文介绍了如何在Google Blogger中隐藏主页上具有特定标签的所有帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑编码",技术",日记"是博客上的一些标签,我不想在首页上显示所有日记"标签的帖子(以及其余的标签帖子),所以我想要去做 ?我希望该XML代码从首页隐藏带有某些标签的帖子![我在yahoo,google,yandex等搜索引擎上搜索了无数次相同的东西,但是我什么也没得到,[希望blogger/xml社区应该有所帮助!]

Let's consider, "Coding", "Technical","Diary" are some labels on blog and I do not want to display all "diary" label's posts on homepage (with my rest of the label post's) so what I want to do ? I want that XML code to hide post's with some labels from homepage ! [I search uncountable times same thing on search engines like yahoo,google,yandex,etc but I didn't got anything, [ hope blogger/xml community should help !]

查看图像以查看标签

推荐答案

在模板(模板-编辑HTML)中搜索以下强调(粗体)代码

Search for the following emphasised (bold) code in your template (Template - Edit HTML)

....
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "static_page"'> 
....

<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 != "LabelYouWantToHide"'>
                <b:include data='post' name='post' />
            </b:if>
        </b:if>
    </b:loop>
<b:else/>
    <b:include data='post' name='post' />
</b:if>

LabelYouWantToHide 替换为要从首页隐藏的真实标签名称.另外,为使上述代码正常运行,请确保要隐藏的帖子上只有 1个标签.

Replace LabelYouWantToHide with the real label name you want hidden from the homepage. Also for the above code to work correctly, make sure the posts that you want to hide only has 1 label on them.

要记住的另一件事是,博客中的每个帖子(至少是首页上的帖子)都应带有标签,否则它们将不会在首页上显示,因为 b:loop 语句不会不会被他们处死

Another thing to remember is that every post in your blog (at least the ones on the homepage) should have a label otherwise they would not be visible on the homepage because the b:loop statement wouldn't be executed for them

这篇关于如何在Google Blogger中隐藏主页上具有特定标签的所有帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆