How to paginate gallery

Hi everyone,
I have been trying this pagination for the gallery for some time, but not able to achieve it. I’m not sure how to connect .paginator.pages to the below gallery code. I know it is possible. I request someone who is good at understanding Hugo codes to help me out. not able to get the pagination for my gallery:

Under layouts/gallery/single.html I have this code:

<div class="container my-5">
    <div class="masonry">
        {{range .Resources.Match "gallery/*" -}}
        {{ $image := . }}
        <div class="masonry-item">
            <a data-fancybox="gallery" href="{{.RelPermalink}}" aria-label="{{.Name}}">
                <img src="{{ $image.RelPermalink }}" class="masonry-content lazyload" alt="{{.Name}}">
            </a>
        </div>
        {{- end }}
    </div>
</div>

My WebPage link: https://www.geotattoos.com/gallery/tattoo-making/

I tried this code https://codepen.io/vikrammehta/pen/YjydEM

My content files:
image

Under the gallery/tattoo-making/gallery, I have all the images. I have more than 300 photos which have to be divided into pages. Kindly let me know how can I do it. Thank you!

1 Like

Hi,

Please do not resurrect old posts. The topic you were replying to has been marked solved. If the solution marked does not work for you, then your question should be a new post.

Okay sure! Sorry for that.