I would like to be able to access data:post.labels from within the header at Blogger. I only plan to make use of it when data:blog.pageType == "item", so there won’t be any confusion with regard to multiple posts on a page. However, nothing I have tried has yielded any results. Here’s what I plan to do with the data if I discover a way to get access to it:
<b:if cond='data:blog.pageType == "item"'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='label.name == "poetry"'>
<meta expr:content='"Poem “" + data:blog.pageName + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='label.name == "article"'>
<meta expr:content='"Article “" + data:blog.pageName + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='label.name == "lists"'>
<meta expr:content='"Poem list “" + data:blog.pageName + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
</b:loop>
</b:if>
All of my posts are either poems, articles on poetry, or poem lists, and labeled appropriately. So, if I can figure out some way to access the labels used by the post, this should work.
Any assistance would be appreciated.
p.s. Don’t worry about the open quotation marks in the code–they’re open and close quotation marks and they work just fine without having to use the Unicode value.
I spent quite a while looking for a solution some time ago. I finally came to the conclusion (well others advising me did) that data:post.labels is only available within the blog-posts widget: if you’re outside that (eg in the header) it’s not available.
Someone did suggest some code to populate an array with the labels while in blog-posts, and call it after that. But I never took that any further because really I wanted access to the labels before I reach the post-widget.
My original discussion was at: http://www.google.com/support/forum/p/blogger/thread?tid=188cd44d0908f736&hl=en