I have some experience in HTML and CSS but proper coding like Java, JS and PHP I am a novice to, plus this is the first time that I have built a Blogger Template/Site from scratch so it is a lot of trial and error. I have tried looking for an answer but I couldn't find an answer that I felt was relevant to what I was looking for.
As standard we know that the Blog1 widget will show your most recent post in its entirety on the landing page along with the author details, comments and labels in the footer. My question is can you alter the code to call for only the first label to be displayed at the bottom of the post?
As standard this is the syntax used to call for the labels list within the native blogger coding:
<b:if cond='data:top.showPostLabels and data:post.labels'>
<data:postLabels/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a>
<b:if cond='not data:label.isLast'>,</b:if>
</b:loop>
</b:if>
I though that maybe altering the b:loop to say a b:include would stop blogger calling for more of the labels and would maybe stop at just one, but when I changed this it basically stopped the entire blog from being displayed!
All I want is for it to be "Labels: Label1" instead of "Labels: Label1, Label2, Label3, etc" without resorting to limiting the amount of labels to just one.
Thanks in advance to anyone who replies and helps.
Mark
You can use index
attribute which gives zero-based index of post labels through the loop
<b:if cond='data:top.showPostLabels and data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' index='i' var='label'>
<b:if cond='data:i == 0'>
<a expr:href='data:label.url' rel='tag'>
<data:label.name/>
</a>
</b:if>
</b:loop>
</b:if>