Duplicate Image thumbs in simple gallery

I am at my wits end. I’m developing a GitHub Pages site using Jekyll. Im new at Jekyll but get the basic principles. The problem I’m having happens locally and also when published on GitHub pages. I get duplicate thumbnails in an image gallery Im trying to get working. They duplicate only twice, which is extra weird.

The offending page is at: Galleries | Smart Learning : Activities & Ideas
My repo is at GitHub - Penworks/smartlearning: record of work done

I’m implementing a simple gallery - without any plugins - using the method from Damien Farrell, similar to the WaywardMark method (but that’s slightly different). Im currently testing so have two different galleries on the galleries.md page. Both galleries have the same problem.

I’ve edited the urls of the Damien Farrell code to work with my site and they parse correctly. There are no loose tags or non-closed loops. I just cannot work out what I’m doing wrong.

config.yml urls

imagesurl: "/assets/galleries/"
thumbsurl: "/assets/thumbs/"

Code in the gallery.html include

<div class="image-gallery">
    {% assign sorted = site.static_files | sort: 'date' | reverse %}
    {% for file in sorted %}
    {% if file.path contains include.folder %}
     {% if file.extname == '.jpg' or file.extname == '.png' %}
    {% assign filenameparts = file.path %}
    {% assign filename = filenameparts | last | replace: file.extname,"" %}
    <div class="box">
            <a href="{{site.baseurl}}{{ site.imagesurl }}{{ include.folder }}/{{ file.name }}" title="{{ filename }}"><img src="{{site.baseurl}}{{ site.thumbsurl }}{{ include.folder }}/{{ file.name }}" alt="{{ filename }}" class="img-gallery" /></a>
    </div>
    {% endif %} 
    {% endif %}
    {% endfor %}
</div>

Code in the galleries.md

## Literary London Images

{% include gallery.html folder="literary-london-ar" %}

## Malta Democracy Images

{% include gallery.html folder="malta-democracy-ar" %}

I am totally baffled by this problem.

Replying to just let any others who are searching about these kinds of issue: In terms of my problem with twice duplicate thumbs produced by the dmfarrell code, I have no idea still why it was happening. It even did that with text. I replaced the liquid data call with an edited version of Jimmy Xiao code. I wont link it bc this reply will get swept into spam. Google Jimmy Xiao Lightgallery.

This post was stuck in the forum spam bin for about a week. I therefore had to find the solution elsewhere. Im disappointed in the inefficiency of this forum as I use several others with this forum tech and they work perfectly well without recklessly banning people’s posts. Sorry to say it really failed me.

Another post I tried that also got swept into spam - this one didnt have any links in it. These were NOT my first posts in this forum.
Getting duplicate image post entries in simple gallery loop

bummer. The forum was setup years ago and usually works great, no idea why you had issues. I don’t think any of us actively replying to stuff have admin access to see what is going on behind the scenes.

tx for taking the time to reply to this. I appreciate it’s not really anyone’s fault for spam bot behaviour if its unpredictably stringent. But if a forum like this one isn’t accepting completely legitimate and non-spammy posts to get help from more experienced coders then it kind of defeats the object. I use a Grav forum just like this and it has never spam trapped my posts. Ive had really prompt help from that community. Likewise with DEVONthink. So the Jekyll Talk admin team might need to re-evaluate how they’ve implemented their spam blockers.