v5Tutorial Complete Blogger Tutorials

Blogger <b:expr> Attribute

Use expr attribute to insert values.
  • Set attribute values.
  • Use data dictionary values.
  • Expr is basically used in conjuction with data tags.

HTML expr Syntax

Blogger expr can set a attribute value.

<a expr:href='data:blog.homepageUrl'>Home</a>
<img expr:src='data:post.thumbnailUrl'/>
<div expr:class='data:post.oldLinkClass'>Old Link</div>
Use expr with attribute.

Usage of expr Attribute

Go to Template > Edit HTML.

Blogger Section: new

<html>
<head>
<title><data:blog.pageTitle/></title>
<b:skin/>
</head>

<body>
<a expr:href='data:post.url'>Current Page URL</a>

<b:section id='new'>
  <b:widget id='Blog1' type='Blog'/>
</b:section>

</body>
</html>
This example shows how to output current page URL.

HTML expr Examples




  • <a expr:href='data:blog.homepageUrl'>Home</a>
    A home link with the blog's homepage url.




  • <a expr:href='data:blog.homepageUrl + "feeds/posts/default"'>Posts RSS</a>
    A link with the blog's post RSS feed url. The ‘+' operator concatenates the two strings.




  • <a expr:class='data:post.allowComments ? "comment" : "no-comment">Comment</a>
    A link with the class "comment" when comments are allowed, and "no-comment" when they are not. The ternary operator (?:) takes the given boolean value and picks the first value (after the ?) if the boolean is true, or the second value (after the :) if the boolean is false.
  • Related Post

    Java Scripts