how easily address similar files?

21 views
Skip to first unread message

qwerjqkbw...@mailinator.com

unread,
Mar 1, 2019, 4:07:40 AM3/1/19
to nikola-discuss
I want to make blog with lot of thematical series consisting of
- blogs (/posts)
- listings (/listing)
- pictures (/images /galleries)
- other files (/files)

such serie may be like ../AVR/beginers/crosscompile/.. , and another serie would be ../AVR/hw/devices/.., another ../theory/geometry/... all with articles like intro, index, lesson1, lesson2, lesson3, ..., resume, (as well as some unique names)
where each article would use some files common to this one serie (like logo, shared downloads, ...) and some special files (like example1, example2 ...) which would be shared by one or two articles

As those files tends to have similar name and the full group would be used in one serie, but not in other. So I would use directory structures to separate them acordingly.

Is there any easy way to target such files based on path of current article? Like if I have /posts/AVR/beginers/crosscompile/lesson1.rst to address /listings/AVR/beginers/crosscompile/example1.sh not with this full path, but something like /listings/${thisDir}/example1.sh ?

Or is there some other way to enrich Nikola with something, which would translate it while making output, but leave original /posts/.../file.rst unchanged?

It would be really convenient to have such feature, especially for /images/${thisDir}/logo.png and other reccuring referencies ...

Thanks for any hint

Chris Warrick

unread,
Mar 3, 2019, 3:02:37 PM3/3/19
to Nikola—Discuss
On Fri, 1 Mar 2019 at 10:07, <qwerjqkbw...@mailinator.com> wrote:
> Is there any easy way to target such files based on path of current article? Like if I have /posts/AVR/beginers/crosscompile/lesson1.rst to address /listings/AVR/beginers/crosscompile/example1.sh not with this full path, but something like /listings/${thisDir}/example1.sh ?
>
> Or is there some other way to enrich Nikola with something, which would translate it while making output, but leave original /posts/.../file.rst unchanged?
>
> It would be really convenient to have such feature, especially for /images/${thisDir}/logo.png and other reccuring referencies ...

There is no built-in way to do this. You could try creating something
like this with shortcodes, although I don’t think this will get into
core, since there are so many possible variants for path layouts.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Gilhad Jediny

unread,
Aug 11, 2019, 6:47:11 PM8/11/19
to nikola-discuss
I found a way to "hack" it somehow, so for reference and all, who may have similar problems I will post it here.

Also all hints are welcome.

http://micro-corner.gilhad.cz/blog/2019/2019-08-11-nikola-making-projects-with-shared-resources.html


Basically I create symlink subdirs like listings, images, ... under /posts/AVR/beginers/crosscompile/ which points to respective directories in /listings/blog/AVR/beginers/crosscompile/ , /images/blog/AVR/beginers/crosscompile/ ... and also create same structure under /files, where those symlinks points to respective directories under /output

Needs delete symlinks in output after nikola build fails and run nikola build again, but it is not such big deal, as managing all long paths in all posts, especially, if I want to move them around for better organisations sometimes
nikola_links.sh
Reply all
Reply to author
Forward
0 new messages