2019-08-11 Nikola - making projects with shared resources - or How make easy links in nikola
Problem with paths and shared files is, that project had to be split to many directories (posts, listings, images, files, ...) and when some pages can have identical name accross projects (like index, example1, summary, etc. etc) each project had to occupy different subdirectory in post to avoid conflicts. So addressing all images, listings ... is complicated, as there must be every time repeated the path of the project and it is hard to auto-fill it when editing posts.
I asked at forum, but there is not easy solution to it and also it does not seem to be common problem (maybe another static generator address it better, but it is hard to say and find all other possible problems there - so I tried to hack nikola somehow).
My hack is, that each project directory (or even each post directory) will have symlinks like listings, images, etc. which would go to respective directories under /listings, /images ... where I will create subdir structure named blog (as all my post go to /blog subdir by conf.py) and in /files I will create the same structure and symlinks to respective output/listing/... etc. directories.
Then I am able to use short names like images/logo.jpg and listings/example1.ino in my posts (and editor can complete those filenames), put all pictures and listings in this "directories" by symlinks, while in output they will end under the project directory with the same names thanks to symlinks in /files.
Ofcourse there is a catch - nikola build would fail, as it makes the output files and directories in other order ((and maybe even random), than I would like. So sometimes the symlinks from /files are copied as symlink, sometimes like directories filled with the right files. The fix is easy - just delete all symlinks in /output (by find output/ -type l -delete ) and run nikola build again, this time successfully.