Answers.Body: <p>The same way as <code>entry</code> is available if you hit an entry, the variable <code>category</code> is available if you hit a category. </p>
  
  <p>Thus the following code: </p>
  
  <pre><code>{% if category is defined %}
      {# Specific category selected #}             
  {% else %}
      {# No specific category selected #}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T13:36:27.133Z
Answers.LastActivityDate: 2020-02-28T13:36:27.133Z
Answers.UserDisplayName: nitech
Body: <p>My URL:
  <a href="http://localhost/product-family/compressors" rel="nofollow noreferrer">http://localhost/product-family/compressors</a></p>
  
  <p>How can I list the related products? 
  I don't understand how to get access to the <code>compressors</code> (a category entry of the product-family category type). The product-family is a structure - so there may be many levels. </p>
  
  <p>(I thought I'd have access to the currently selected category via <code>entry</code> but I get error when I try to access it.)</p>
  
Tags: <category><request><querystring>
Title: List products related to currently active category (url)
ThreadText: # List products related to currently active category (url)
  
  (Asked by: username_0 on 2020-02-28)
  
  My URL:
  <http://localhost/product-family/compressors>
  
  How can I list the related products?
  I don't understand how to get access to the `compressors` (a category entry of the product-family category type). The product-family is a structure - so there may be many levels.
  
  (I thought I'd have access to the currently selected category via `entry` but I get error when I try to access it.)
  
  **Tags:** category, request, querystring
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-28. Score: 1 | Accepted answer
  
  The same way as `entry` is available if you hit an entry, the variable `category` is available if you hit a category.
  
  Thus the following code:
  
  ```
  {% if category is defined %}
      {# Specific category selected #}             
  {% else %}
      {# No specific category selected #}
  {% endif %}
  
  ```
  
  
  ---
  
  