Answers.Body: <p>As long as you're using commas to separate the tag names in the URL:</p>
  
  <pre><code>mysite.com?queryurl&amp;tags=cheese,egg,bacon&amp;cat=sandwich
  </code></pre>
  
  <p>then you should be able to retrieve the multiple tags like so:</p>
  
  <pre><code>{% set tagsString = craft.request.getParam('tags') %}
  
  {% set tags = craft.tags.name(tagsString).find() %}
  
  &lt;ul&gt;
      {% for tag in tags %}
          &lt;li&gt;{{ tag.name }}&lt;/li&gt;
     {% endfor %}
  {/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-14T10:13:45.520Z
Answers.Text: So I shouldn't be creating a route at all - I should be using the search instead?
  Small typo on the closing `</ul>` element.
Answers.UserDisplayName: jamus
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-14T13:49:32.160Z
Answers.Text: This code seems to work without the code above being required to set "tags"?
  `<ul>
      {% for tag in tags %}
          <li>{{ tag.name }}</li>
     {% endfor %}
  {/ul>`
Answers.UserDisplayName: jamus
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-13T17:34:38.397Z
Answers.LastActivityDate: 2014-08-13T17:34:38.397Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>Ok. I think I worked this out (with a little help from Brad and the search example page). Though there might be a better way of achieving the same result.</p>
  
  <pre><code>    &lt;ul&gt;Looking for:
      {% for tag in tags %}
          &lt;li&gt;{{ tag.name }}&lt;/li&gt;
      {% endfor %}
      &lt;/ul&gt;
  </code></pre>
  
  <p>The code above demonstrates that Craft pulls the tags from the URL into the an array called "tags" automatically(?). For each entry I loop through these tags - for each one loop through the entries tags to see if they match. I set matchFound to false before starting and at the end of each entry. If I hit a matching tag I set it to true to remove entries being listed multiple times. </p>
  
  <pre><code>{% for tag in tags %}
  
          {% for thisItemTag in entry.tags %}
  
                  {% set lookingFor = tag.name %}
                  {% set currentTag = thisItemTag %}
  
                  &lt;!-- &lt;li&gt;{{ thisItemTag }}&lt;/li&gt; --&gt;
                  {% if lookingFor == currentTag %}
                      {% if matchFound == false %}
                          {% set matchFound = true %}
                          &lt;article class="product"&gt;
                              &lt;h3&gt;{{ entry.title }}&lt;/h3&gt;
                          &lt;/article&gt;
                      {% endif %}
                  {% endif %}
          {% endfor %}
  
      {% endfor %}
      {% set matchFound = false %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-14T14:07:07.570Z
Answers.LastActivityDate: 2014-08-14T14:07:07.570Z
Answers.UserDisplayName: jamus
Body: <p>I understand how to set up a route and template that allows me to display entries by tag.</p>
  
  <p>But how can I set up a template + route to grab multiple tags (if supplied but could just be one) from the url and display entires that have these tags?</p>
  
  <p>I would also like to add a category element (showing all the entires from a category with the selected tags) but suspect much of that may be answered by the first part.</p>
  
  <p>For example</p>
  
  <p>Have a form the builds a url depending on user selections</p>
  
  <p>mysite/queryurl&amp;tags=cheese,egg,bacon&amp;cat=sandwich</p>
  
  <p>Is this possible?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-08-13T16:03:45.783Z
Comments.Text: I have just discovered `{% set query = craft.request.getParam('tags') %}` on the search example page. I will investigate this.
Comments.UserDisplayName: jamus
Tags: <tags><routes>
Title: Create a route to display entries with multiple tags
ThreadText: # Create a route to display entries with multiple tags
  
  (Asked by: username_0 on 2014-08-13)
  
  I understand how to set up a route and template that allows me to display entries by tag.
  
  But how can I set up a template + route to grab multiple tags (if supplied but could just be one) from the url and display entires that have these tags?
  
  I would also like to add a category element (showing all the entires from a category with the selected tags) but suspect much of that may be answered by the first part.
  
  For example
  
  Have a form the builds a url depending on user selections
  
  mysite/queryurl&tags=cheese,egg,bacon&cat=sandwich
  
  Is this possible?
  
  **Tags:** tags, routes
  
  > **Comments:**
  > **username_0**: I have just discovered `{% set query = craft.request.getParam('tags') %}` on the search example page. I will investigate this.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-08-13. Score: 4
  
  As long as you're using commas to separate the tag names in the URL:
  
  ```
  mysite.com?queryurl&tags=cheese,egg,bacon&cat=sandwich
  
  ```
  
  then you should be able to retrieve the multiple tags like so:
  
  ```
  {% set tagsString = craft.request.getParam('tags') %}
  
  {% set tags = craft.tags.name(tagsString).find() %}
  
  <ul>
      {% for tag in tags %}
          <li>{{ tag.name }}</li>
     {% endfor %}
  {/ul>
  
  ```
  
  > **Comments:**
  > **username_0**: So I shouldn't be creating a route at all - I should be using the search instead? Small typo on the closing `</ul>` element.  
  > **username_0**: This code seems to work without the code above being required to set "tags"? `<ul>     {% for tag in tags %}         <li>{{ tag.name }}</li>    {% endfor %} {/ul>`  
  
  ---
  
  ### Answer by username_0 on 2014-08-14. Score: 1
  
  Ok. I think I worked this out (with a little help from username_1 and the search example page). Though there might be a better way of achieving the same result.
  
  ```
      <ul>Looking for:
      {% for tag in tags %}
          <li>{{ tag.name }}</li>
      {% endfor %}
      </ul>
  
  ```
  
  The code above demonstrates that Craft pulls the tags from the URL into the an array called "tags" automatically(?). For each entry I loop through these tags - for each one loop through the entries tags to see if they match. I set matchFound to false before starting and at the end of each entry. If I hit a matching tag I set it to true to remove entries being listed multiple times.
  
  ```
  {% for tag in tags %}
  
          {% for thisItemTag in entry.tags %}
  
                  {% set lookingFor = tag.name %}
                  {% set currentTag = thisItemTag %}
  
                  <!-- <li>{{ thisItemTag }}</li> -->
                  {% if lookingFor == currentTag %}
                      {% if matchFound == false %}
                          {% set matchFound = true %}
                          <article class="product">
                              <h3>{{ entry.title }}</h3>
                          </article>
                      {% endif %}
                  {% endif %}
          {% endfor %}
  
      {% endfor %}
      {% set matchFound = false %}
  
  ```
  
  
  ---
  
  