Answers.Body: <p>You should replace <code>postCategories</code> with whatever the handle of the category field is for your entry.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-05T08:42:53.283Z
Answers.LastActivityDate: 2020-05-05T08:42:53.283Z
Answers.UserDisplayName: Oli
Answers.Body: <p>Thank you Oli for helping with this simple quest. Here's the code that worked for me. ("decade" being the name of the field I'm using in the backend, putting out the category group!) </p>
  
  <pre><code>    {% for category in entry.decade.all() %}
        &lt;a href="{{ category.url }}""&gt;
          {{- category.title -}}
        &lt;/a&gt;
      {% endfor %}
  
    {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-05T08:43:43.713Z
Answers.LastActivityDate: 2020-05-05T08:43:43.713Z
Answers.UserDisplayName: Maggie
Body: <p>I feel like I'm missing something totally obvious here, but how do I output a category name for a category that is part of a category group on a single entry layout? The name of the category group is 'Archive' and the slug 'archive'.</p>
  
  <p>Here is what I'm trying to do.</p>
  
  <p><code>&lt;a href="*dynamic url to category index*"&gt;*name of category*&lt;/a&gt;</code></p>
  
  <p>Here is what I tried </p>
  
  <p><code>&lt;a href="{{ category.url }}"&gt;{{ category.title }}&lt;/a&gt;</code></p>
  
  <p>However then I get the error "Variable "category" does not exist."</p>
  
  <p>Trying the following code snippet from the official tutorial also did not work.</p>
  
  <pre><code>    {% for category in entry.postCategories.all() %}
        &lt;a href="{{ category.url }}"&gt;
          {{- category.title -}}
        &lt;/a&gt;
      {% endfor %}
    {% endif %}
  </code></pre>
  
  <p>resulting in the following error: "Calling unknown method: craft\elements\Entry::postCategories()"</p>
  
  <p>Any help to solve this probably very simple problem is appreciated. Thank you!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-05T08:30:01.187Z
Comments.Text: You should replace `postCategories` with whatever the handle of the category field is for your entry.
Comments.UserDisplayName: Oli
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-05T08:35:29.193Z
Comments.Text: @Oli Brilliant, thank you so much! I'd been looking through the official tutorials, but could not find a straight forward answer that worked for me. It's much appreciated!
Comments.UserDisplayName: Maggie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-05T08:42:50.063Z
Comments.Text: Good news! Could you mark this as answered please?
Comments.UserDisplayName: Oli
Tags: <categories><error-message><category>
Title: {{ category.title }} error with category groups
ThreadText: # {{ category.title }} error with category groups
  
  (Asked by: username_0 on 2020-05-05)
  
  I feel like I'm missing something totally obvious here, but how do I output a category name for a category that is part of a category group on a single entry layout? The name of the category group is 'Archive' and the slug 'archive'.
  
  Here is what I'm trying to do.
  
  `<a href="*dynamic url to category index*">*name of category*</a>`
  
  Here is what I tried
  
  `<a href="{{ category.url }}">{{ category.title }}</a>`
  
  However then I get the error "Variable "category" does not exist."
  
  Trying the following code snippet from the official tutorial also did not work.
  
  ```
      {% for category in entry.postCategories.all() %}
        <a href="{{ category.url }}">
          {{- category.title -}}
        </a>
      {% endfor %}
    {% endif %}
  
  ```
  
  resulting in the following error: "Calling unknown method: craft\elements\Entry::postCategories()"
  
  Any help to solve this probably very simple problem is appreciated. Thank you!
  
  **Tags:** categories, error-message, category
  
  > **Comments:**
  > **username_1**: You should replace `postCategories` with whatever the handle of the category field is for your entry.  
  > **username_0**: @username_1 Brilliant, thank you so much! I'd been looking through the official tutorials, but could not find a straight forward answer that worked for me. It's much appreciated!  
  > **username_1**: Good news! Could you mark this as answered please?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-05-05. Score: 2 | Accepted answer
  
  You should replace `postCategories` with whatever the handle of the category field is for your entry.
  
  
  ---
  
  ### Answer by username_0 on 2020-05-05. Score: 1
  
  Thank you Oli for helping with this simple quest. Here's the code that worked for me. ("decade" being the name of the field I'm using in the backend, putting out the category group!)
  
  ```
      {% for category in entry.decade.all() %}
        <a href="{{ category.url }}"">
          {{- category.title -}}
        </a>
      {% endfor %}
  
    {% endif %}
  
  ```
  
  
  ---
  
  