Answers.Body: <p>To get tags defined within a matrix field, you will first want to loop through the matrix-blocks in your matrix; and then loop through the tags in your tags field defined in each block.</p>
  
  <pre><code>{% for block in entry.myMatrixFieldHandle %}
      {% for tag in block.myTagsFieldHandle %}
          {{ tag.title }}
      {% else %}
          No Tags found.
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>Also, for retrieving tags defined in a tags field on an entry (as in your example), you can simply retrieve the tags through the tags field directly, rather than using <code>relatedTo(entry)</code>.</p>
  
  <pre><code>{% for tag in entry.myTagsFieldHandle %}
      {{ tag.title }}
  {% else %}
      No Tags found.
  {% endfor %}
  </code></pre>
  
  <p>For more information please see the documentation for <a href="http://buildwithcraft.com/docs/tags-fields#templating" rel="nofollow">tags</a> and <a href="http://buildwithcraft.com/docs/matrix-fields#templating" rel="nofollow">matrix fields</a>.</p>
  
  <p><strong>Update</strong></p>
  
  <p>If you want to output your tags as you have them displayed in your screenshots, then use this:</p>
  
  <pre><code>    {% for block in entry.technologyField %}
          {% if block.type == "tag" %}
              {% for tag in block.technologyTag %}
                  {{ tag.title }}
              {% else %}
                  No Tags found.
              {% endfor %}
          {% endif %}
      {% endfor %}
  </code></pre>
  
  <p>However, I can also see some potential problems with your naming system and how you are using matrix blocks. Here are some suggestions for improvement.</p>
  
  <ol>
  <li><p>You don't need to end each Tag Group handle with 'TagGroup', as you already know that it's a Tag Group (so instead of 'technologyTagGroup', you can simply call it 'technology').</p></li>
  <li><p>You don't need to end each field handle with 'Field', as you already know that it's a field (so instead of 'technologyField', you can simply call it 'technology').</p></li>
  <li><p>Matrix block types support more than one field — I suspect that instead of having 3 separate block types defined, you actually only want 1 block type defined (let's call it 'technology' for example), with three fields in it: 'text', 'media', and 'tags' (or 'technologyTags' if you prefer).</p></li>
  <li><p>When using a Tags Field Type (or Assets, Entries, Categories or anything else with more than one item), it is generally a good practice to name the field handle plural so that you always know that it contains more than one of something (so instead of 'tag' the field should be called 'tags').</p></li>
  <li><p>If you followed #1, #2, #3, #4 above then the code to output your tags would be:</p>
  
  <pre><code>{% for block in entry.technology %}
      {% for tag in block.tags %}
          {{ tag.title }}
      {% else %}
          No Tags found.
      {% endfor %}
  {% endfor %}
  </code></pre></li>
  <li><p>If you later define another Block Type then when looping through the blocks you will need to check <code>block.type</code>, and only include those that have a Tags Field defined with the handle your looking for ('tags' in this case). For example:</p>
  
  <pre><code>{% for block in entry.technology %}
      {% if block.type == "technology" %}
          {% for tag in block.tags %}
              {{ tag.title }}
          {% else %}
              No Tags found.
          {% endfor %}
      {% endif %}
  {% endfor %}
  </code></pre></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-23T20:48:12.530Z
Answers.Text: I've updated my question. I've tried your answer, but I haven't been able to get it. The entries are outputted on index page. Actually, I put in array a `TagGroupsHandles`, which are defined in Tag fields. Example: Matrix Field `travel` -> Tag Field `tag` (tag source: Tag Group `travel`). Is that correct with my update?
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-23T21:12:47.687Z
Answers.Text: Your updated example won't work if your tag fields are defined in a matrix field. When a tags field (or any relationship field) is defined in a matrix field the relationship is technically created between the 'matrix field' and the 'tags', not the 'entry' and the 'tags'. The example I gave works, you just need to replace the 'myTagsFieldHandle' and 'myMatrixFieldHandle' with your actual field handles as defined in your field settings. If you have more than one related tags field, then you can just loop through both of them in order.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-24T19:58:13.587Z
Answers.Text: You must be right, but does it work under any fields structure? I couldn't get it working. It was kept saying that`Craft\EntryModel and its behaviors do not have a method or closure named tagFieldHandle`. I've updated my questions with screenshots of my fields settings.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-24T23:12:29.993Z
Answers.Text: I updated the example. In the future, when someone uses a generic term like 'tagFieldHandle' you need to replace it with your actual tag field handle — the handle that ***you created*** to identify the field!
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-25T20:23:24.423Z
Answers.Text: I like How you explain things with description. Actually my naming system was the same as you suggested in points #1, #2, #3, #4, It was more clearer for me, but I changed it back. I can't have block types structured as 'Technology, 'Travel', because at the editor's side with UserGroup permission to 'Travel' section only, will see all Block types, that don't relate to that UserGroup. Craft doesn't have that feature yet, If I read right. So with that in mind, I need to loop in all matrixFields, I don't know How yet.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-23T18:04:22.147Z
Answers.LastActivityDate: 2015-02-25T17:19:41.840Z
Answers.LastEditDate: 2015-02-25T17:19:41.840Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>Using the code below, Craft was able to get related tags to an entry, before I decided to move TagFieldType to MatrixFieldType.</p>
  
  <pre><code>{% set entries = craft.entries %}
  
  {% for entry in entries %}
  
     &lt;h3&gt;{{ entry.title }}&lt;/h3&gt;
  
     {% for tag in craft.tags.relatedTo(entry) %}
  
     &lt;li&gt;
       { tag.title }}
     &lt;/li&gt;
  
   {% else %}
  
     &lt;p&gt;No tags found&lt;/p&gt;
  
   {% endfor %}
  
   {% endfor %}
  </code></pre>
  
  <p>I'm quiet struggling to pull tags out so I rather share with you my Field's structure in my CP.</p>
  
  <p><img src="https://i.sstatic.net/GaX5u.png" alt="TagGroup"></p>
  
  <p><img src="https://i.sstatic.net/Se2Vz.png" alt="MatrixFields"></p>
  
  <p><img src="https://i.sstatic.net/LqtmI.png" alt="TagField"></p>
  
  <p>I took many options to consider, Why I can't get it right, even found <a href="https://craftcms.stackexchange.com/questions/5056/query-for-blocks-across-block-types-using-the-new-field-parameter">the post</a>, that same handles may cause a problems, so I gave them all unique handles.</p>
  
  <p><img src="https://i.sstatic.net/AWOFG.png" alt="EntryFieldLayout"></p>
  
Tags: <matrix><entry>
Title: Output tags from matrix fields related to an entry
ThreadText: # Output tags from matrix fields related to an entry
  
  (Asked by: username_0 on 2015-02-23)
  
  Using the code below, Craft was able to get related tags to an entry, before I decided to move TagFieldType to MatrixFieldType.
  
  ```
  {% set entries = craft.entries %}
  
  {% for entry in entries %}
  
     <h3>{{ entry.title }}</h3>
  
     {% for tag in craft.tags.relatedTo(entry) %}
  
     <li>
       { tag.title }}
     </li>
  
   {% else %}
  
     <p>No tags found</p>
  
   {% endfor %}
  
   {% endfor %}
  
  ```
  
  I'm quiet struggling to pull tags out so I rather share with you my Field's structure in my CP.
  
  ![TagGroup](https://i.sstatic.net/GaX5u.png)
  
  ![MatrixFields](https://i.sstatic.net/Se2Vz.png)
  
  ![TagField](https://i.sstatic.net/LqtmI.png)
  
  I took many options to consider, Why I can't get it right, even found [the post](https://craftcms.stackexchange.com/questions/5056/query-for-blocks-across-block-types-using-the-new-field-parameter), that same handles may cause a problems, so I gave them all unique handles.
  
  ![EntryFieldLayout](https://i.sstatic.net/AWOFG.png)
  
  **Tags:** matrix, entry
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-23. Score: 2 | Accepted answer
  
  To get tags defined within a matrix field, you will first want to loop through the matrix-blocks in your matrix; and then loop through the tags in your tags field defined in each block.
  
  ```
  {% for block in entry.myMatrixFieldHandle %}
      {% for tag in block.myTagsFieldHandle %}
          {{ tag.title }}
      {% else %}
          No Tags found.
      {% endfor %}
  {% endfor %}
  
  ```
  
  Also, for retrieving tags defined in a tags field on an entry (as in your example), you can simply retrieve the tags through the tags field directly, rather than using `relatedTo(entry)`.
  
  ```
  {% for tag in entry.myTagsFieldHandle %}
      {{ tag.title }}
  {% else %}
      No Tags found.
  {% endfor %}
  
  ```
  
  For more information please see the documentation for [tags](http://buildwithcraft.com/docs/tags-fields#templating) and [matrix fields](http://buildwithcraft.com/docs/matrix-fields#templating).
  
  **Update**
  
  If you want to output your tags as you have them displayed in your screenshots, then use this:
  
  ```
      {% for block in entry.technologyField %}
          {% if block.type == "tag" %}
              {% for tag in block.technologyTag %}
                  {{ tag.title }}
              {% else %}
                  No Tags found.
              {% endfor %}
          {% endif %}
      {% endfor %}
  
  ```
  
  However, I can also see some potential problems with your naming system and how you are using matrix blocks. Here are some suggestions for improvement.
  
  1. You don't need to end each Tag Group handle with 'TagGroup', as you already know that it's a Tag Group (so instead of 'technologyTagGroup', you can simply call it 'technology').
  2. You don't need to end each field handle with 'Field', as you already know that it's a field (so instead of 'technologyField', you can simply call it 'technology').
  3. Matrix block types support more than one field — I suspect that instead of having 3 separate block types defined, you actually only want 1 block type defined (let's call it 'technology' for example), with three fields in it: 'text', 'media', and 'tags' (or 'technologyTags' if you prefer).
  4. When using a Tags Field Type (or Assets, Entries, Categories or anything else with more than one item), it is generally a good practice to name the field handle plural so that you always know that it contains more than one of something (so instead of 'tag' the field should be called 'tags').
  5. If you followed #1, #2, #3, #4 above then the code to output your tags would be:
  
     ```
     {% for block in entry.technology %}
         {% for tag in block.tags %}
             {{ tag.title }}
         {% else %}
             No Tags found.
         {% endfor %}
     {% endfor %}
  
     ```
  6. If you later define another Block Type then when looping through the blocks you will need to check `block.type`, and only include those that have a Tags Field defined with the handle your looking for ('tags' in this case). For example:
  
     ```
     {% for block in entry.technology %}
         {% if block.type == "technology" %}
             {% for tag in block.tags %}
                 {{ tag.title }}
             {% else %}
                 No Tags found.
             {% endfor %}
         {% endif %}
     {% endfor %}
  
     ```
  
  > **Comments:**
  > **username_0**: I've updated my question. I've tried your answer, but I haven't been able to get it. The entries are outputted on index page. Actually, I put in array a `TagGroupsHandles`, which are defined in Tag fields. Example: Matrix Field `travel` -> Tag Field `tag` (tag source: Tag Group `travel`). Is that correct with my update?  
  > **username_1**: Your updated example won't work if your tag fields are defined in a matrix field. When a tags field (or any relationship field) is defined in a matrix field the relationship is technically created between the 'matrix field' and the 'tags', not the 'entry' and the 'tags'. The example I gave works, you just need to replace the 'myTagsFieldHandle' and 'myMatrixFieldHandle' with your actual field handles as defined in your field settings. If you have more than one related tags field, then you can just loop through both of them in order.  
  > **username_0**: You must be right, but does it work under any fields structure? I couldn't get it working. It was kept saying that`Craft\EntryModel and its behaviors do not have a method or closure named tagFieldHandle`. I've updated my questions with screenshots of my fields settings.  
  > **username_1**: I updated the example. In the future, when someone uses a generic term like 'tagFieldHandle' you need to replace it with your actual tag field handle — the handle that ***you created*** to identify the field!  
  > **username_0**: I like How you explain things with description. Actually my naming system was the same as you suggested in points #1, #2, #3, #4, It was more clearer for me, but I changed it back. I can't have block types structured as 'Technology, 'Travel', because at the editor's side with UserGroup permission to 'Travel' section only, will see all Block types, that don't relate to that UserGroup. Craft doesn't have that feature yet, If I read right. So with that in mind, I need to loop in all matrixFields, I don't know How yet.  
  
  ---
  
  