What would be an easy way to add a navbar that links to the superfolder's index page automatically when exporting org mode files?

46 views Asked by At

In static site generators, it is often possible to automatically add links to pages automatically such that each page links to the previous index page except for the root page. So far, I have avoided the need for a static site generator by using org mode instead, but this is still a problem that seems unapproachable to me.

Obviously it is possible to script in emacs-lisp in some way in order to do this but I don't have much experience and doing so. This would be made a lot simpler with some sort of templating system, but it doesn't seem straightforward to add one, and I don't believe emacs has one built-in.

1

There are 1 answers

0
Preston Pan On

Found the answer. All I did was set html-preamble and html-preamble-format, making it link to the root index page and the local index page. Because my directory structure is not highly recursive, this works well enough; either you are on an index page, in which case clicking home works, or you are not, in which case you can either go to home or go to the local index page. Also, I manually disabled the preamble for the root index page. However, this will not work for recursive directory structure where you have a hierarchy of index pages. This may require actual decision making based on the file name, which I still don't know how to do.