saimn / sigal

yet another simple static gallery generator
http://sigal.saimon.org/
MIT License
888 stars 168 forks source link

`Sort: ` metadata for album only overrides 'albums_sort_attr' not 'medias_sort_attr' #453

Open hossman opened 2 years ago

hossman commented 2 years ago

album_information.rst says...

- *Sort*: the sort order for this album. If prefixed with a '-' it will be in
  reversed order.

...but this only seems to apply to sorting "sub albums" because it's only used in Album.sort_subdirs()

Album.sort_medias() doesn't seem to know/care about either self.meta['sort'] so media files are only ever sorted by the (global) medias_sort_attr setting for the entire gallery.

saimn commented 2 years ago

Indeed. Would be useful to have the feature for sort_medias, not sure if it should be the same metadata key though ?

hossman commented 2 years ago

... not sure if it should be the same metadata key though ?

Given the current design of sigal -- where an album can either have sub-albums or images, but not both -- I'm not sure why it wouldn't make sense to say "The Sort: metadata in index.md can be used to override either the albums_sort_attr or medias_sort_attr configuration setting, depending on wether the album contains sub-albums or media."

If you plan to change the design, to allow albums to contain both sub-albums and media (and i have some loose thoughts on this i could put in a in issue if you're interested ... comments from peanut gallery as a person not very familiar with the code) then it would probably make sense to have distinct keys that correspond with the distinct config settings

saimn commented 2 years ago

If you plan to change the design, to allow albums to contain both sub-albums and media (and i have some loose thoughts on this i could put in a in issue if you're interested)

See #408 ;). (This was supported and then removed to simplify the templates maintenance... and I did not think this was a very useful and widely used feature. Support was added back in galleria in #438)