如何隐藏在Google Blogger主页上显示某些标签的所有帖子?

时间:2022-09-12 19:37:16

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 !]

让我们考虑一下,“编码”,“技术”,“日记”是博客上的一些标签,我不想在主页上显示所有“日记”标签的帖子(我剩下的标签帖子)所以我想做什么?我希望这个XML代码用主页上的一些标签隐藏帖子! [我在搜索引擎上搜索无数次同样的东西,比如雅虎,谷歌,yandex等,但我没有得到任何东西,[希望博客/ xml社区应该帮忙!]

check image to view label

检查图像以查看标签

1 个解决方案

#1


0  

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

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

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

Replace that line (aka <b:include data='post' name='post'/> ) with

替换该行(又名 )

<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>

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.

将LabelYouWantToHide替换为您想要从主页隐藏的真实标签名称。同样,要使上述代码正常工作,请确保要隐藏的帖子上只有1个标签。

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

另外要记住的是,博客中的每个帖子(至少是主页上的帖子)应该有一个标签,否则它们将不会在主页上显示,因为不会为它们执行b:loop语句

#1


0  

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

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

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

Replace that line (aka <b:include data='post' name='post'/> ) with

替换该行(又名 )

<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>

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.

将LabelYouWantToHide替换为您想要从主页隐藏的真实标签名称。同样,要使上述代码正常工作,请确保要隐藏的帖子上只有1个标签。

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

另外要记住的是,博客中的每个帖子(至少是主页上的帖子)应该有一个标签,否则它们将不会在主页上显示,因为不会为它们执行b:loop语句