Conditional logic to add class for specific section entries I'm trying to create a conditional logic so that the class 'white-nav-bg' is added to the  element on the 'blog' section entries only.

Below is the code I'm currently using to try and achieve this with a logic tag but it is adding the 'white-nav-bg' class to all pages on the site rather than just the blog section entry pages.

&lt;nav class="navbar navbar-default navbar-fixed-top
  {% for entry in craft.entries.section('blog').limit(1) %}
    {% if entry.type.handle == 'post' %}white-nav-bg{% endif %}
  {% endfor %}"&gt;


This code is in the '_layout.html' file, hence needing to figure out how to do conditional logic tags rather than adding the code differently in the blog template files.

After much time looking through Craft documentation I can't seem to find an example of how to do this. Any help would be gratefully received.

UPDATE:

Following helpful answers I have come to the following code, which works and allows me to define multiple sections to have the 'white-nav-bg' class.

{% set segment1 = craft.request.segment(1) %}
&lt;nav class="navbar navbar-default navbar-fixed-top
  {% if segment1 == 'blog' %}
    white-nav-bg
  {% elseif segment1 == 'our-work' %}
    white-nav-bg
  {% endif %}"&gt;
There are many possibilities for this.

One of them is to listen to the section handle if you want it to be triggered only on the blog template:

{% if entry.section.handle == 'blog' %}your-class{% endif %}