Use a hidden Repeating Group as data source for gallery navigation

I have the following setup in my slideshow app which displays one “post” in full-screen at a time:

  1. Galleries - These define the template and structure for displaying the posts. Galleries have one or many tags.
  2. Posts - These contain images and have one or many tags.
  3. Tags - These are used to match posts to current gallery.

When a gallery is loaded, I am using a URL param to identify the current post. The url looks like this /gallery/12345?post=12345

This works great - I can load the post inside the gallery without any issues. The problem is when I want to load the next post in the gallery using a button.

I can easily load a random post (or first/last post) using an advanced filter to identify all of the posts which have the same tags as the gallery and display a random/first/last item that doesn’t match current item’s id. The problem is that this only works once and then the original post is loaded on the next button push.

I am trying to determine the best way to determine the current post’s relationship to the other posts that meet the same criteria (where gallery tags intersect with post tags, count > 0).

One way I think I can do this is by loading all of the posts in a repeating group and conditionally displaying one post where the id matches the URL param, but then I still don’t have the ability to access the current cell index outside of the repeating group.

Another way would be to create a hidden repeating group with the same source criteria and try to find a match for the current gallery post inside that group and then somehow extract & use the index that way.

Is there a plugin that will let me make connections like this to a cell in a RG to elements outside of the RG? I’d love any ideas. Thanks!

SOLVED: I added the Toolbox plugin, then added a List of Numbers to my page. This made using the repeating group (layout - 1 column, 1 row, full width & height) the easiest option for the solution here. I’m still using URL params to load the first “post” but from there I use the “Show Next” workflow action to show the next post in the list and so on. Just posting for anyone else interested.