Hey guys,
I searched a lot about it, saw some topics, but nothing that explained to me this question: how can I create a pagination for specific tag inside an array of tags?
I tryed to look after all pages and filter it using an “If”, but the final result isn’t what I’m looking for, because the filter only removes the content for the current page, not all of them, letting a page with 10, other with 2 results when my content is like 100k posts spreaded in 60 items per page.
So, I’m looking for a solution or logic (that I’m not sure how to do it) that create the correct pagination for that items that has an specific tag listed in their Front Matter.
So, this is an example of a generated Front Matter:
{
"title": "Player Unknow's Battlegrounds Video 01",
"tags": [
"action",
"third-person",
"first-person",
"fps",
"shooter"
],
"date": "2017-12-09",
"categories": [
"PC"
],
"slug": "player-unknows-battlegrounds-video-01",
"url": "/video?id=9pl23N-qC",
"draft": false,
"views": 0,
"embedURL": "https://path/to/youtube/video",
"duration": "11:56",
"thumbnail": "https://path/to/my/cdn/file.png",
"flipbook": [
"https://path/to/my/cdn/file01.png",
"https://path/to/my/cdn/file02.png",
"https://path/to/my/cdn/file03.png",
"https://path/to/my/cdn/file04.png",
"https://path/to/my/cdn/file05.png"
],
"sourceName": "YouTube",
"sourceURL": "http://youtube.com/"
}
There are other posts with tha same tags or at least, with one of these tags.
All of my posts are located inside one section/type, called “posts” (folder “content/posts”), and I was trying this to create the pagination of specific posts, filtered by a tag:
{{ range (.Paginate (where (where .Data.Pages "Type" "posts") "Params.tags" "intersect" "action")).Pages }}
<div class="col s2">
<a href="{{ .URL }}">
<img src="{{ .Params.thumbnail }}" alt="{{ .Title }}" title="{{ .Title }}" class="responsive-img">
<p>{{ index .Params.categories 0 }}</p>
</a>
</div>
{{ end }}
But, no pagination is created using this nested where and nothing is printed. As you can see here:
So, I would like to know what I’m doing wrong or if HUGO support this kind of search, and if don’t what is the best approach that I can do to solve this issues?
Thank you all, for your time! I really appreciate!