kc0bfv/autophugo

image-number-{{ .index }} does not reflect custom sort order when using weights

Closed this issue · 1 comments

I left a comment on commit 9de0a45 but now I'm not sure if you get notified on this...

I think you introduced a small bug when you added the image_number back. You are using .index, which is set by the caller list.html. However, in that file index is set while resources are still in alphanumerical order, BEFORE they are resorted by weight.

As a result the overview shows images correctly sorted by weight, but the full view uses a different order.

Thanks! I think I got a notification, but I didn't notice it until logging in specifically, whereas this sent me an email (still took me forever to get back to it).

Yup - this bug was actually visible on the "cats" demo site page previously, and I think I saw it several times but I didn't pay enough attention to why the cats were ordered strangely in full image view.

I don't think my fix causes any regressions. I removed the old wrong index totally, but I think it was only being used for gallery sorting and the hash view (ok, one problem with my fix, if someone has a link based on "image_number_" it may now change...
hopefully most direct links are hashes now). Then I reindexed in the loop just before divying up into columns. This also sets indexes for subalbums, but subalbums still won't show up in the full view - they and their index number will just get ignored (still will cause another problem if anyone still has an image_number_ link, but, "in for a penny...").