1

I would like to create a "landing page" to act as an entry point for my org files. Ideally this landing page would contain links that automatically update every time a new org file is added or edited. It would be great if the links could be organised in a way that preserves some of the directory heirarchy (like a table of contents).

Is this possible in org-mode? If so, how would I go about it?

EDIT: something in a similar vein to doctoc but for org files and directories. I want it to traverse the given directory, import the #+TITLE:s and display them (possibly in some kind of tree structure that mirrors the directory structure).

9
  • Can you add a simple example (a small directory hierarchy with a handful of directories and a handful of files - not only Org mode files, unless your "real" hierarchy will only include Org mode files) and what the "landing page" Org mode file would look like? In particular, if an existing file is changed, what information on the landing page would reflect that change? There is probably nothing built-in that would come even close to what (I imagine) you are describing, so it'd have to be built. And the syncing part in particular would be tedious to do in Emacs - it'd need help from the OS.
    – NickD
    Apr 19, 2023 at 18:50
  • 1
    Sounds like you're looking for a file manager, supporting tree view.
    – nichijou
    Apr 19, 2023 at 20:07
  • @nichijou Like e.g. treemacs. Apr 19, 2023 at 22:31
  • @Fergie or if you'd realy prefer the 'landing page' then it would be handy to know why (this is preferred over the tree-browser). Anyway, in that case, I think the problem should be quite easy to solve (and we could help think about a solution) Apr 19, 2023 at 22:31
  • Thanks for the feedback- see my EDIT in the original question
    – Fergie
    Apr 20, 2023 at 9:29

1 Answer 1

1

You could write a script in your preferred programming language. Here is a naive idea. I'm sure it could be improved since I'm no developer.

Suppose ~/tmp/ is the entry point for your org files:

$ tree ~/tmp/
~/tmp/
├── Abc
│   ├── Alef
│   │   └── alef.org
│   └── Bet
│       ├── beta.org
│       └── bet.org
├── testing.org
├── test.org
└── tmp.org

You could build a script based on find results:

$ find ~/tmp/
~/tmp/
~/tmp/test.org
~/tmp/Abc
~/tmp/Abc/Bet
~/tmp/Abc/Bet/beta.org
~/tmp/Abc/Bet/bet.org
~/tmp/Abc/Alef
~/tmp/Abc/Alef/alef.org
~/tmp/testing.org
~/tmp/tmp.org
  • Write * tmp
  • Skip first line
  • If a line contains an extension that is not .org, discard the line
  • If a line contains a .org extension, write - [[content of the line][content of the line after the last /, minus extension]]
  • If a line doesn't contain an extension, write * then write * for every / after tmp, then write a space, then write the term before the last /.

This script will produce:

* tmp
- [[~/tmp/test.org][test]]
** Abc
*** Bet
- [[~/tmp/Abc/Bet/beta.org][beta]]
- [[~/tmp/Abc/Bet/bet.org][bet]]
*** Alef
- [[~/tmp/Abc/Alef/alef.org][alef]]
- [[~/tmp/testing.org][testing]]
- [[~/tmp/tmp.org][tmp]]

There is an issue though, the proper output should be that instead:

* tmp
- [[~/tmp/test.org][test]]
- [[~/tmp/testing.org][testing]]
- [[~/tmp/tmp.org][tmp]]
** Abc
*** Bet
- [[~/tmp/Abc/Bet/beta.org][beta]]
- [[~/tmp/Abc/Bet/bet.org][bet]]
*** Alef
- [[~/tmp/Abc/Alef/alef.org][alef]]

In order to solve this issue, one has to find a way to have find printing its results according to some hierarchical order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.