CSS

Friday, December 9, 2011

Blogger conditional tags

Conditional tags allow you to specify parts of your template to appear only under certain conditions.

Kalo pernah buka HTML Template Blogger, mungkin pernah ngeliat yang kaya gini..

    <b:if cond='data:blog.pageType == &quot;index&quot;'> 
      <title><data:blog.title/></title> 
    <b:else/> 
      <title><data:blog.pageName/> | <data:blog.title/></title> 
    </b:if>

Hasil dari tags diatas, pas kita ngunjungin Blog Home, yang kita liat di Title Bar cuman Nama Blog aja (data:blog.title), tapi pas kita buka Postingan atau Article yang kita liat di Title Bar Judul Article | Nama Blog (<data:blog.pageName/> | <data:blog.title/>)

Facebook Open Graph Meta Tags

  <b:if cond='data:blog.pageType == &quot;index&quot;'> 
      <title><data:blog.title/></title> 
      <meta expr:content='data:blog.title' property='og:title'/>
      <meta expr:content='data:blog.homepageUrl' property='og:url'/>
  <b:else/> 
      <title><data:blog.pageName/> | <data:blog.title/></title> 
      <meta expr:content='data:blog.pageName + &quot; | &quot; + data:blog.title' property='og:title'/>
      <meta expr:content='data:blog.url' property='og:url'/>
  </b:if>
Hasil Share ke Facebook

-------------------

Home Page Only

To display only on home page
    <b:if cond='data:blog.url == data:blog.homepageUrl'>
    What is in here will be displayed only on home page
    </b:if> 

Archive Page Only

To display only on archive page
    <b:if cond='data:blog.pageType == &quot;archive&quot;'> 
    What is in here will be displayed only on archive page
    </b:if> 

Item/Post Page Only

To display only on item page
    <b:if cond='data:blog.pageType == &quot;item&quot;'> 
    What is in here will be displayed only on item page
    </b:if> 

Static Page Only

To display only on static pages
    <b:if cond='data:blog.pageType == &quot;static_page&quot;'> 
    What is in here will be displayed only on static page
    </b:if> 

Specific URL Only

To display only on specific URL
    <b:if cond='data:blog.url == &quot;http://aing-creations.blogspot.com/&quot;'> 
    What is in here will be displayed on above URL only
    </b:if> 

Certain Labels Only

To display only on certain labels only
  <b:loop values='data:post.labels' var='label'>
    <b:if cond='data:label.name == &quot;what the f&quot;'> 
    What is in here will be displayed only on Posts which have label what the f
    </b:if> 
  </b:loop>
You will need to be inside Blog Posts loop in order to use Certain Labels Only code

4 comments:

ndeletz said...

ga di kasih preview

Ŷú ŚőéĶámŤí said...

azzzzzzzzzzz
ringkas ameet ccd

DJ-Deny Jackrose said...

Ijiiin sedot gan ...

Anonymous said...

for example nya mana ne....