You can solve this with a shortcode.
Here is what I do in my blog:
Shortcode gallery.html:
`
And in a post you can insert images like this:
`{{< gallery
“/images/renovigo/IMG_3833.jpg”
“/images/renovigo/IMG_3834.jpg”
“/images/renovigo/IMG_3842.jpg”
“/images/renovigo/IMG_3844.jpg”
“/images/renovigo/IMG_3846.jpg”
“/images/renovigo/IMG_3847.jpg”
“/images/renovigo/IMG_3848.jpg”
“/images/renovigo/IMG_3849.jpg”
“/images/renovigo/IMG_3850.jpg”
}}`
This gives me a gallery with three pictures in a row and one, two or three rows.
It’s a hack.