Answers.Body: <p>The code you're using at the moment is trying to output the tags that are in use on <em>any/all</em> entries:</p>
  
  <pre><code>{% set entries = craft.entries.section('news').limit(null) %}
  </code></pre>
  
  <p>If I understand you correctly, you want to output the tags only for the <em>current</em> entry, right? </p>
  
  <p><em>This is explained with very useful examples in the <a href="https://craftcms.com/docs/tags-fields#templating" rel="nofollow noreferrer">documentation</a>.</em></p>
  
  <p><strong>Solution</strong></p>
  
  <p>Assuming you already have the <code>entry</code> variable set, you could do the following:</p>
  
  <pre><code>&lt;ul&gt;
      {% for tag in craft.tags.relatedTo(entry) %}
          &lt;li&gt;{{ tag.title }}&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Another example adapted from the docs:</p>
  
  <pre><code>{% set tags = entry.tagsFieldHandle %}
  
  {% if tags | length %}
  
      &lt;ul&gt;
          {% for tag in tags %}
              &lt;li&gt;{{ tag.title }}&lt;/li&gt;
          {% endfor %}
      &lt;ul&gt;
  
  {% endif %}
  </code></pre>
  
  <p>You first set the variable <code>tags</code> to the tags related to your <code>entry</code>. Then, you check if there are tags related to the entry. If there are, you iterate over them.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T13:19:56.060Z
Answers.Text: @Wayne Does this answer help you? If not, ask more questions. If so, please mark it as accepted!
Answers.UserDisplayName: Connor Bär
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T13:48:23.810Z
Answers.Text: Using the second example of your code I get the following error. Internal Server Error
  
  Craft\EntryModel and its behaviors do not have a method or closure named "tagsFieldHandle".
Answers.UserDisplayName: Wayne
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T17:26:45.970Z
Answers.Text: That's because `tagsFieldHandle` is only an example. You should replace it with the handle of your `tags` field. At some point you created a field in the Craft control panel to select tags for your post, right? Use the handle of that field.
Answers.UserDisplayName: Connor Bär
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T12:50:19.090Z
Answers.LastActivityDate: 2017-04-11T23:47:46.007Z
Answers.LastEditDate: 2017-04-11T23:47:46.007Z
Answers.UserDisplayName: Connor Bär
Body: <p>I’m trying to add tags to my blog posts.</p>
  
  <p>I’ve created a tags group with the handle ‘default’.</p>
  
  <p>In Setting/Fields I’ve got a field called bodyElements which is setup as a matrix, and within bodyElements I’ve added to the Configuration a block type called Tags with a handle of ‘tags’, and then within that there’s a field called Tags with a handle of ‘blogTags’ and this is set as the Field Type of “Tags” and the Source is set as “Tags”.</p>
  
  <p>Now when I go to a blog post, I can type in my content and click the button to add a Tag. I can then type in a tag and it attaches to that particular entry.</p>
  
  <p>The issue I’m having is that when I view the blog posts on the front end, the tags are showing up on every single post, even though they don’t have those tags attached to them.</p>
  
  <p>On <a href="https://craftcms.com/support/active-tags" rel="nofollow noreferrer">https://craftcms.com/support/active-tags</a> it says to insert the following code to display only the tags that are in use</p>
  
  <pre><code>{% set entries = craft.entries.section('news').limit(null) %}
  &lt;ul&gt;
      {% for tag in craft.tags.relatedTo(entries) %}
          &lt;li&gt;{{ tag.title }}&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>but that doesn’t display the tags at all.</p>
  
  <p>My blog section has a handle of ‘blog’, so in the above code I tried replacing ‘news’ with ‘blog’ and still no tags appear.</p>
  
  <p>The only way I can get tags to appear on my posts is by using the following code:</p>
  
  <pre><code>{% for tag in craft.tags.group(‘default’) %}
      &lt;li&gt;&lt;a href="{{ url('blog/tags/'~tag.id) }}"&gt;{{ tag.title }}&lt;/a&gt;&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>but the above code caused the tags to appear on every single blog post, even if they’re not tagged with anything.</p>
  
  <p>How do I get the tags to only appear on the posts the tags are attached to?</p>
  
  <p>Thanks.</p>
  
Tags: <tags>
Title: How do I get tags to only display on posts that have that tag?
ThreadText: # How do I get tags to only display on posts that have that tag?
  
  (Asked by: username_0 on 2017-04-11)
  
  I’m trying to add tags to my blog posts.
  
  I’ve created a tags group with the handle ‘default’.
  
  In Setting/Fields I’ve got a field called bodyElements which is setup as a matrix, and within bodyElements I’ve added to the Configuration a block type called Tags with a handle of ‘tags’, and then within that there’s a field called Tags with a handle of ‘blogTags’ and this is set as the Field Type of “Tags” and the Source is set as “Tags”.
  
  Now when I go to a blog post, I can type in my content and click the button to add a Tag. I can then type in a tag and it attaches to that particular entry.
  
  The issue I’m having is that when I view the blog posts on the front end, the tags are showing up on every single post, even though they don’t have those tags attached to them.
  
  On <https://craftcms.com/support/active-tags> it says to insert the following code to display only the tags that are in use
  
  ```
  {% set entries = craft.entries.section('news').limit(null) %}
  <ul>
      {% for tag in craft.tags.relatedTo(entries) %}
          <li>{{ tag.title }}</li>
      {% endfor %}
  </ul>
  
  ```
  
  but that doesn’t display the tags at all.
  
  My blog section has a handle of ‘blog’, so in the above code I tried replacing ‘news’ with ‘blog’ and still no tags appear.
  
  The only way I can get tags to appear on my posts is by using the following code:
  
  ```
  {% for tag in craft.tags.group(‘default’) %}
      <li><a href="{{ url('blog/tags/'~tag.id) }}">{{ tag.title }}</a></li>
  {% endfor %}
  
  ```
  
  but the above code caused the tags to appear on every single blog post, even if they’re not tagged with anything.
  
  How do I get the tags to only appear on the posts the tags are attached to?
  
  Thanks.
  
  **Tags:** tags
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-11. Score: 2
  
  The code you're using at the moment is trying to output the tags that are in use on *any/all* entries:
  
  ```
  {% set entries = craft.entries.section('news').limit(null) %}
  
  ```
  
  If I understand you correctly, you want to output the tags only for the *current* entry, right?
  
  *This is explained with very useful examples in the [documentation](https://craftcms.com/docs/tags-fields#templating).*
  
  **Solution**
  
  Assuming you already have the `entry` variable set, you could do the following:
  
  ```
  <ul>
      {% for tag in craft.tags.relatedTo(entry) %}
          <li>{{ tag.title }}</li>
      {% endfor %}
  </ul>
  
  ```
  
  Another example adapted from the docs:
  
  ```
  {% set tags = entry.tagsFieldHandle %}
  
  {% if tags | length %}
  
      <ul>
          {% for tag in tags %}
              <li>{{ tag.title }}</li>
          {% endfor %}
      <ul>
  
  {% endif %}
  
  ```
  
  You first set the variable `tags` to the tags related to your `entry`. Then, you check if there are tags related to the entry. If there are, you iterate over them.
  
  > **Comments:**
  > **username_1**: @username_0 Does this answer help you? If not, ask more questions. If so, please mark it as accepted!  
  > **username_0**: Using the second example of your code I get the following error. Internal Server Error  Craft\EntryModel and its behaviors do not have a method or closure named "tagsFieldHandle".  
  > **username_1**: That's because `tagsFieldHandle` is only an example. You should replace it with the handle of your `tags` field. At some point you created a field in the Craft control panel to select tags for your post, right? Use the handle of that field.  
  
  ---
  
  