Hi,
I would like from a Shortcode to display a list of topics according to the categories and tags parameters provided.
I manage to display it with a category and a tag, but not with several tags or categories.
However, the rendering of my variable returns the tags in the form "tag1" "tag2"
, but not in display.
I tried escaping them as specified in a post on the forum and I also tried simple quotes to surround my tags. tag='"tag1" "tag2"'
Here is the shortcode and the template of the shortcode.
{{< selected_post title="title with markdown" tag="tag1" cat="cat1" >}}
{{ $title := (.Get "title" | markdownify) }}
{{ $tag := (.Get "tag") }}
{{ $cat := (.Get "cat") }}
<p>{{ $title }}</p>
<p>{{ $cat }}</p>
<p>{{ $tag }}</p>
<div class="container bg-light border border-2 rounded p-3">
<h5 class="text-center" >{{ $title }}</h5>
<ul class="list-unstyled">
{{ range where (where .Site.RegularPages ".Params.categories" "intersect" (slice $cat)) ".Params.tags" "intersect" (slice $tag ) }}
<li >
<a class="text-decoration-none" href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</div>
Thank you in advance for your help.