sigal icon indicating copy to clipboard operation
sigal copied to clipboard

standard config file lookup

Open anarcat opened this issue 6 years ago • 3 comments

so in my long, ongoing shopping list, i'd like to add the capacity to load configuration files from standard locations. what i am doing right now is that i have a base config file that I copy all over the place. i think that's silly: that config file should work for gallery A as well as gallery B, without me having to copy that thing over. yes, they will have the same name: I don't care about that. in fact, ideally all relevant config files would be merged on top of each other so i could have a base, global config file with sane defaults and then be able to override that with a one-line config per gallery.

so, for example, I'd like sigal to load /etc/sigal.conf if it's available, then ~/.config/sigal.conf and ./sigal.conf (current default). i am not sure what --config should do - maybe it could just wipe that list and replace it with a single config.

would this be a good idea? i looked at the code briefly and i don't think it would be impossible to do...

anarcat avatar Jan 31 '18 15:01 anarcat

Nothing is impossible ;), but I'm not sure about this. IMO a config file is tied to a specific gallery, as you may want to use different directories/theme/plugins/etc. for different galleries. And I think that global config are often introducing confusion because it's easy to forget that there is a global config somewhere. Another point is that current config files are Python file, not just text. It can contain real Python code, maybe not something that I would put in /etc. But Sigal is not just for me, so if it is useful and if you want to code this, and if it does not add to much complexity, then I can live with it.

saimn avatar Feb 06 '18 22:02 saimn

After digging a little I realized I could have a common sigal conf file for all galleries, given that in my context, same thumbnail sizes, source and destination folders, author etc.

album title

The possibility to have album title in index.md is very nice. Suggesting that a warning appears, like "no index.md file, will use directory name as album title". In my first albums I directly changed sigal source code because I didn't know.

Zip

Having zip_gallery be a constant file-name is a no-go because you don't want people to have all the zips they download from your site being named archive.zip.

So, I use this and suggest it could be new default or new example in conf file comment:

zip_gallery = 'Photo album {album.author} - {album.title}.zip'

*Still, the need expressed by @anarcat is relevant.

like "no index.md file, will use directory name as album title"

There could be a logging message, indeed.

zip_gallery = 'Photo album {album.author} - {album.title}.zip'

That would be a good addition to the config file comment :+1: . Contributions are welcome ;)

saimn avatar Jun 24 '20 01:06 saimn