During my adventures tweaking the album plugin to read image metadata I've encountered some unexpected behavior. My tweaks populate the ?tag from the xmp:subject tag in the image and the file is written to the transient underlay.
The tag links get created but the corresponding /tag/* page isn't auto created until I run a full --rebuild. Checked in pages appear to get instantly autotagged and their tag pages created.
There is some discussion about autotagging and transients on this site. But I can't quite descipher what is now the expected behaviour with autotagging and transients.
Anyone able to explain if the above scenario is as it should be? (for whatever reason) --kjs
I think I can see why this wouldn't work: ikiwiki calculates the set of potential "autofiles" (automatically-created pages, normally in the transient underlay), once, then creates them. It does not check after it has created them to see whether it should create any more for some reason. I'm not sure whether it should or not.
One possible workaround would be for your tag-extraction code to call
IkiWiki::Plugin::tag::gentag
itself, at the same time it callsadd_autofile
for its own automatically-created page.Having metadata like tags in transient pages seems a somewhat precarious situation anyway: your wiki is structurally different, depending whether the transient pages have turned up or not. That doesn't seem ideal?
Whenever I've looked into making album extract metadata from photos, my idea had been that it would generate "real pages" that get committed to git, so that the metadata gets copied out of the opaque binary with no useful diff, that is not necessarily even in the VCS (I use an underlay for photos), and into an editable text format in git with useful diffs and history.
Thanks for the gentag tip will try it out.
About transients being precarious. In my workflow I like the metadata to be regenerated if the image changes. Generally I don't want my local image library to diverge from the published one and I'd like to avoid duplicating efford changing the metadata in two places. The simplest way of doing this is to upload images with changed metadata again or use cli exif tools with the server mounted as sshfs copying only metadata across to the image files. Editing mdwns to match the exif data is much more complicated and time consuming.
The brilliant thing with the transient would be that I could check in the files I don't want auto updated, cases where the web should diverge from my local files, whilst the transients would just get replaced. A magic solution to a potentially complex problem.
Unfortunately there is a catch with the album lugin as it fails to update the album if I change or add images to the underlay. It may build the files but it then doesn't recognize the files it has created requiring a rebuild. By touching the file with the album directive before changing any images and committing / pushing the directive file the problem is mitigated. Forgetting this have however caused a lot of rebuilds
--kjs
Gentag solved the tag page autocreation problem. Thanks again for the tip! --kjs