开发者

What is b:if? How do I make it return true if it's home page?

I came across the b:if argument in Blogger, I'm not to sure how to use it. I need to make a condition return true if i开发者_开发知识库t's the front page. How do I do it?

Thanks


<b:if> is a so called widget tag. See the complete list of widget tags in the Blogger help pages. For the values of the condition you can use layout data tags.

For the detection for the front page, there are at least two possibilities:

<b:if cond='data:blog.pageName == ""'>
  <!-- Place markup for the front page and archives here -->
<b:else/>
  <!-- Place markup for posts here -->
</b:if>

Alternative:

<b:if cond='data:blog.pageType == "item"'>
  <!-- Place markup for the posts here -->
<b:else/>
  <!-- Place markup for front page and archive here -->
</b:if>

Have look at an example to customize the page title for search engine optimization.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜