搜索页面的 Blogger 条件语句
Blogger Condition statement for search page
我正在为不同的页面使用自定义 header 图片。
我有一个常用的 header 用于索引页面,还有一个用于搜索页面。
这是带有 AND 条件的代码显示索引页 header 仅适用于索引页而不适用于搜索页。
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.pageType!= data:blog.searchQuery'>
<div class='picheader'>
<img alt='abc' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div>
Our description
</div>
</b:if>
</b:if>
<!-- Only for search page -->
<b:if cond='data:blog.searchQuery'>
<div class='picheader'>
<img alt='Search Page' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div>
Looking for something...
</div>
</b:if>
但使用此代码,索引页没问题,但索引页 header 也在加载搜索页 header。
如何解决?
试试这个代码:
<!-- If it is an Index page -->
<b:if cond='data:blog.pageType == "index"'>
<!-- If it is search page -->
<b:if cond='data:blog.searchQuery'>
<div class='picheader'>
<img alt='Search Page' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div>
Looking for something...
</div>
<!-- If it is an Index page but not Search page -->
<b:else/>
<div class='picheader'>
<img alt='abc' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div>
Our description
</div>
</b:if>
</b:if>
条件 data:blog.pageType != data:blog.searchQuery
将始终 return 为真(除非您搜索 'index')。这就是为什么它也在搜索页面上显示的原因。
我正在为不同的页面使用自定义 header 图片。 我有一个常用的 header 用于索引页面,还有一个用于搜索页面。
这是带有 AND 条件的代码显示索引页 header 仅适用于索引页而不适用于搜索页。
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.pageType!= data:blog.searchQuery'>
<div class='picheader'>
<img alt='abc' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div>
Our description
</div>
</b:if>
</b:if>
<!-- Only for search page -->
<b:if cond='data:blog.searchQuery'>
<div class='picheader'>
<img alt='Search Page' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div>
Looking for something...
</div>
</b:if>
但使用此代码,索引页没问题,但索引页 header 也在加载搜索页 header。 如何解决?
试试这个代码:
<!-- If it is an Index page -->
<b:if cond='data:blog.pageType == "index"'>
<!-- If it is search page -->
<b:if cond='data:blog.searchQuery'>
<div class='picheader'>
<img alt='Search Page' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div>
Looking for something...
</div>
<!-- If it is an Index page but not Search page -->
<b:else/>
<div class='picheader'>
<img alt='abc' src='image url' style='width:500px;height:300px;'/>
<br/><br/>
<div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div>
Our description
</div>
</b:if>
</b:if>
条件 data:blog.pageType != data:blog.searchQuery
将始终 return 为真(除非您搜索 'index')。这就是为什么它也在搜索页面上显示的原因。