Answers.Body: <p>There are three <a href="http://buildwithcraft.com/docs/sections-and-entries#section-types" rel="noreferrer">types of sections</a> in Craft: singles, structures, and channels. You can use <code>entry.section.type</code> to test if the current page is displaying one of these section types.</p>
  
  <pre><code>{% if entry.section.type == "channel" %}
  
      &lt;p&gt;This is a channel&lt;/p&gt;
  
  {% elseif entry.section.type == "single" %}
  
      &lt;p&gt;This is a single&lt;/p&gt;
  
   {% elseif entry.section.type == "structure" %}
  
      &lt;p&gt;This is a structure&lt;/p&gt;
  
   {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-01T16:42:09.317Z
Answers.LastActivityDate: 2015-07-01T16:42:09.317Z
Answers.UserDisplayName: Dylan T
Body: <p>How would I write a variable to detect if the current page/Url I'm viewing is for an entry, rather than a section home page or a single?</p>
  
  <p>i.e</p>
  
  <pre><code>{% if I'm currently viewing an entry %}
      do this
  {% else %}
      do this
  {% endif %}
  </code></pre>
  
Tags: <variable>
Title: Variable to check if viewing an entry?
ThreadText: # Variable to check if viewing an entry?
  
  (Asked by: username_0 on 2015-07-01)
  
  How would I write a variable to detect if the current page/Url I'm viewing is for an entry, rather than a section home page or a single?
  
  i.e
  
  ```
  {% if I'm currently viewing an entry %}
      do this
  {% else %}
      do this
  {% endif %}
  
  ```
  
  **Tags:** variable
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-01. Score: 5 | Accepted answer
  
  There are three [types of sections](http://buildwithcraft.com/docs/sections-and-entries#section-types) in Craft: singles, structures, and channels. You can use `entry.section.type` to test if the current page is displaying one of these section types.
  
  ```
  {% if entry.section.type == "channel" %}
  
      <p>This is a channel</p>
  
  {% elseif entry.section.type == "single" %}
  
      <p>This is a single</p>
  
   {% elseif entry.section.type == "structure" %}
  
      <p>This is a structure</p>
  
   {% endif %}
  
  ```
  
  
  ---
  
  