# Get all posts with a specific tag from params

**URL:** <https://discourse.gohugo.io/t/get-all-posts-with-a-specific-tag-from-params/19931>\
**Category:** support\
**Created:** [July 31, 2019, 6:49pm UTC](https://discourse.gohugo.io/t/get-all-posts-with-a-specific-tag-from-params/19931 "2019-07-31T18:49:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [July 31, 2019, 6:49pm UTC](https://discourse.gohugo.io/t/get-all-posts-with-a-specific-tag-from-params/19931/1 "2019-07-31T18:49:59Z")

</div>

I have a set of pages and related content defined by tags, some of which include spaces.

So I have been trying to get a list of these pages using variants of the following:

`{{ $contentWithTag := where $.Site.RegularPages "Tag" "Bruno Amaral" }}`

and a where statement using `.Site.Taxonomies.tags`.

The process is harder, because I get the needed tag from the params of the current page. Using a printf statement might help, but how would I fetch a tag that includes spaces and caps?

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [August 3, 2019, 12:58pm UTC](https://discourse.gohugo.io/t/get-all-posts-with-a-specific-tag-from-params/19931/2 "2019-08-03T12:58:53Z")

</div>

This looks like a ugly way to do it, but it works:

```auto
{{ $posts := slice }}
{{ range where .Site.RegularPages "Type" "post" }}
	{{ if in .Params.tags $name }}
		{{ $posts = $posts | append . }}
	{{ end }}
{{ end }}
{{ $mentions := $posts | symdiff .Data.Pages }}
{{ with $mentions }}
	<h5 class="text-center title">{{ i18n "mentions" }}</h5>
	<div class="row">
		{{ range $mentions }}
			{{ .Render "summary" }}
		{{ end }}
	</div>
{{ end }}

```

Is there any way I can avoid having to range over the posts and appending to the slice?
