Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

html - Condition not met inside <b:if> tag unless changed to full address

I'm trying to display dynamic content based on which page is currently loaded. This code is inside Blogger's theme HTML (creating my custom theme).

<b:if expr:cond='data:blog.url == data:blog.homepageUrl + "p/blog.html">
  <b:section id='blog-content' name='Blog content'>
    <b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
  </b:section>
</b:if>

However, even when navigating to the myblog.blogspot.com/p/blog.html (NOTE: blog address changed) this condition is not met and nothing is shown (I've tried displaying <h1>This is blog</h1>).


I've tried printing out contents of data:blog.url and data:blog.homepageUrl using

<b:eval expr='data:blog.url'><br/>
<b:eval expr='data:blog.homepageUrl + "p/blog.html"'/><br/>

These returned identical strings.


When replacing ... == data:blog.homepageUrl + "p/blog.html"> to ... == myblog.blogspot.com/p/blog.html (NOTE: blog address changed), i. e., not using stored blog URL but hard-coding expected address, the check seems to pass and blog content is displayed.

Anyone else encountered the problem or might know a solution to this problem?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...