I have a small problem when I export links that are included in properties.

The goal of my approach is simple: use the properties of Org mode, then export them to html. The export of these properties works fine, but the links are not exported correctly. For example, on this screenshot using org roam, you can see the result :

My html page looks like this : enter image description here

The rectangle represents the properties of the headline, so I can add (with this line : #+OPTIONS: prop:("Author" "ID" "another_property" etc) ) the author, number_of_page or all properties for the export. And these properties can have a number, a string or a link to another headline/file as their value. Unfortunately, when exporting, the link in property values is not usable, unlike the one below (the one that is not in the properties).

You can try with this little example (replace my file with one of yours of course) :

#+title: Test
#+OPTIONS: prop:("Test" "anotherpropertiestoexport")
* It's a headline
:Test:  [[file:6Archives.org][File]]
Test:   [[file:6Archives.org][File]]

How can I export in such a way as to have functioning links in property values?

  • 1
    You cannot: syntactically, an Org mode property has a name and a value and both of them, and in particular the value, are strings (not numbers, not links: just strings). So when the Org mode parser parses a property drawer, it sees the contents of the drawer above as the single string "Test: [[file:6Archives.org][File]]\n" and renders it accordingly. If you look at the resulting .html file, you will see the difference between the two "links". The fact that the property value is recognized as a link in the Org mode buffer is entirely accidental: convenient but accidental.
    – NickD
    Jan 8 at 14:12
  • If you decide that you want to hack the code, you need to look at org-html-property-drawer, but you should be aware that there are similar handlers in every exporter, so modifying one handler will only get what you want for that particular exporter. If you really need the feature, you can try posting a feature request on the Org mode mailing list, but chances are that it is not going to be implemented.
    – NickD
    Jan 8 at 14:50
  • Ok thanks a lot, I will make a script to modify my html file after the export
    – Cletip
    Jan 9 at 15:41
  • For an ad-hoc conversion, look into filters. The property-drawer filter is probably the most appropriate (or perhaps the node-property filter - I'm not sure).
    – NickD
    Jan 9 at 16:17
  • Ok I see the idea, I will try. Thank you again !
    – Cletip
    Jan 10 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.