Lambda expressions again works on the basic principle of if and else condition. Point to note that these new expressions work on a set of elements and practically Blogger have 3 sets only we can work on.
What lambda expression does?
Above code check each post and each label in it. When a label name flower is found, an image tag is added.
<b:if cond=’data:post.labels any (label=> label.name == “Flower”)’> <img src=’/img/flower.jpg’ /> </b:if>
Basic syntax of lambda expression is:
[set of items] [lambda operator] ([lambda expression])
The syntax for lambda expression is:
[variable name] => [expression]
Set of items
A point to note here that you will be able to filter the post which are present on that page, means you cannot access your all posts from a single page.
<b:if cond='data:blog.pageType == "index"'> <b:if cond='data:posts any (post => post.author != "Hamza Dhamiya")'> <!--Do some work here--> </b:if> </b:if>
Above code let you see if the post have labels of the choice only, if it doesn't then it will return false; else if all labels are matching the condtion then it will return true.
<b:loop var='post' values='data:posts filter (post => post.author == "Hamza Dhamiya")'> <b:include data='post' name='post'/> </b:loop>
In result all the labels will be returned with "#" attached to them.
<b:loop values='data:post.labels map (label => "#" + label.name)' var='label'> <a expr:href='data:label.url'><data:label/></a> </b:loop>