Use a URL Slug to Search Entries by Tag
Problem
You want to pass a tag to an URL slug to only show entries related to that tag.
Solution
The links:
<ul class="sub-menu">
{% set allTags = craft.entries.section('blog').limit(null) %}
{% for tags in craft.tags.relatedTo(allTags) %}
<li><a href="/templateName/{{ tags.name }}">{{ tags.name }}</a></li>
{% endfor %}
</ul>
The display template for example.com/templateName/tagName
:
{% set searchTag = craft.request.getSegment(2) %}
{% for opinion in craft.entries.section('blog').search(searchTag) %}
{% if opinion is defined %}
...
{% endif %}
{% endfor %}
Submitted by Shanan on 1st February, 2017