Create pagination for specific tag inside array of tags

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": [
    "date": "2017-12-09",
    "categories": [
    "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": [
    "sourceName": "YouTube",
    "sourceURL": ""

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>
{{ 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!

Where are you trying to show the pagination? A reminder:

Hugo supports pagination for your homepage, section pages, and taxonomies.

I can’t be sure, but it looks like you want to create it somewhere else. Check out requesting help, and post a repo link. We have to see how your site is configured, and which templates you are editing. :slight_smile:

Hey @maiki, thanks for reply!

So, I’m testing the pagination in a default file, “list.html”. Am I wrong?

We can’t really troubleshoot something like pagination without seeing the source, because there are a lot of moving parts, and no one here wants to play 20 questions. :slight_smile:

Does your site have a public repo you can share with us? Or can you put together a small demo for what you want to do? Then we can just clone it and check it locally, which gets results.

No, it isn’t in a public repo, it’s private, for a client and I can’t share it.

Or can you put together a small demo for what you want to do?

What I want to do is what I described above. Create a pagination for pages (posts) filtered by a specific tag inside the tags list. Basically, the code to filter and create the pagination is exactly that one showed above too. The site’s theme is just basic partials like head, header, footer, menu and scripts, and the core baseof, list and single, all html files.

The config.toml has just this information:

baseURL = "<value>"
languageCode = "<value>"
title = "<value>"
theme = "<value>"
googleAnalytics = "<value>"
paginate = 60

    # Meta
    name = "<value>"
    subtitle = "<value>"
    description = "<value>"
    keywords = "<value>"
    googleSiteVerification = "<value>"

But, I understand if you can’t help without seen the code. Anyway, thanks! :slight_smile: