2012-04-18 58 views
0

基本上我想用博客的條件標籤來做到這一點。可能嗎?Blogger的條件標籤有可能嗎?

if blog page type = item page 
    if a label called 'test' exists 
    <div class='test'> 
    else 
    <div> 
    /if 
/if 

回答

2

取決於你想要做什麼,以及在哪裏。據我所知,data:post元素只能在<b:includable id='main'></b:includable>標籤內訪問。這裏有一個小東西,應該可以幫助你開始:

<b:if cond='data:blog.pageType == &quot;item&quot;'> 
    <b:loop values='data:post.labels' var='label'> 
    <b:if cond='label.name == &quot;MY LABEL X&quot;'> 
     <div>LABEL X specific content.</div> 
    </b:if> 
    <b:if cond='label.name == &quot;MY LABEL Y&quot;'> 
     <div>LABEL Y specific content</div> 
    </b:if> 
    </b:loop> 
</b:if> 

此時,該<b:loop ...>...</b:loop>方法是我所知道的可以訪問個人標籤名稱的唯一途徑。這是未經測試的代碼,因此您可能需要搗鼓它。