Answers.Body: <p>I would just leave the URL field blank for parent categories.</p>
  
  <p>In the template you could check if the the category is level two before outputting the URL field.</p>
  
  <pre><code>{% if category.level == 2 and category.categoryUrl %}
      {{ category.categoryUrl }}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-16T21:23:06.733Z
Answers.LastActivityDate: 2019-05-16T21:23:06.733Z
Answers.UserDisplayName: Simon Kuran
Body: <p>I'm stuck on a problem with categories. I never worked with them before so maybe it's not as difficult a I think.</p>
  
  <p>I need the following structure:</p>
  
  <p>Type of company 1 (e.g. Bakery)<br>
      -Bakery 1 + website<br>
      -Bakery 2 + website<br>
      -Bakery 3 + website</p>
  
  <p>Type of company 2 (e.g. Supermarket)<br>
      -Super 1 + website<br>
      -Super 2 + website<br>
      -Super 3 + website  </p>
  
  <p>So my parent categories only need 1 field (type of company)
  and the children need 2 types of fields (url + company name)</p>
  
  <p>How can I accomplish this?</p>
  
Tags: <categories><structure>
Title: Sub categories with extra field
ThreadText: # Sub categories with extra field
  
  (Asked by: username_0 on 2019-05-16)
  
  I'm stuck on a problem with categories. I never worked with them before so maybe it's not as difficult a I think.
  
  I need the following structure:
  
  Type of company 1 (e.g. Bakery)  
  -Bakery 1 + website  
  -Bakery 2 + website  
  -Bakery 3 + website
  
  Type of company 2 (e.g. Supermarket)  
  -Super 1 + website  
  -Super 2 + website  
  -Super 3 + website
  
  So my parent categories only need 1 field (type of company)
  and the children need 2 types of fields (url + company name)
  
  How can I accomplish this?
  
  **Tags:** categories, structure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-16. Score: 1 | Accepted answer
  
  I would just leave the URL field blank for parent categories.
  
  In the template you could check if the the category is level two before outputting the URL field.
  
  ```
  {% if category.level == 2 and category.categoryUrl %}
      {{ category.categoryUrl }}
  {% endif %}
  
  ```
  
  
  ---
  
  