Export node with links in properties cleanly

Hey everyone ! My question is quite simple : when exporting properties, for example in HTML, properties with nodes are displayed incorrectly. You can try with the following example (taking of course a node that exists in your properties)

#+OPTIONS: prop:("author")

* Test
:PROPERTIES:
:ID:       9979ee12-5f9d-467a-90f0-01ad3c4ba410
:author:   [[id:04df64c6-03c6-47be-ad04-b647695dbcdd][Aragon]]
:END:

Say otherwise, with this exemple, the display in Emacs is perfect. But, when you make C-c C-e, and then h for html and o for export and open, the display is like this : [[id:04df64c6-03c6-47be-ad04-b647695dbcdd][Aragon]], and not like this : Aragon

Thanks you in advance for your answer ^^.

Any reason why you don’t do something like this below and don’t export the link?

#+OPTIONS: prop:("author")

* Test
:PROPERTIES:
:ID:       9979ee12-5f9d-467a-90f0-01ad3c4ba410
:author:   Aragon
:link:   [[id:04df64c6-03c6-47be-ad04-b647695dbcdd]]
:END:

Just as a side note: it would be probably quicker if you asked this Org general question in Stack Exchange or Reddit…

Thanks for your answer. I am new and I wasn’t sure where to put my question, so I put it in something pretty general ^^
Should I move it to Stack Exchange?

The reason is pretty simple: I want to be able to click on “Aragon” and go directly to the corresponding node, not just have written “Aragon” and not know if a node exists for it or not.

I would like, in the end, to do something a bit like this with HTML pages (see the rectangle on the right on any wikipedia page), the aesthetics I will see later ^^: Elsa (recueil) — Wikipédia

But maybe there is a better solution than properties to this.

So…

  • You write some articles in Org mode and would like to publish a website
  • Some of the articles are on a work of literature, for which you would like to include links to its author(s)
  • The links to the author information should be published in a specific layout, probably with using a specific html tag or css class

Something like this?

I need others to step in to help you. I do not publish Org articles as a website. Just trying to clarify what you are trying to do, so that others can see if they can help you.

One thing is … if you use Org-ID, you need to replace it with a normal link somehow. It would be an additional thing you need to consider.

So… Why do you need the link to the author to be Org-ID based? Is this because you want to use Org-roam? Why don’t you just write your articles in other formats, such as markdown or directly in html? Or use some static site generator such as Hugo that can parse Org — there are other posts on Hugo and publishing in this forum if you search.

Sorry for my delay ^^

“- You write some articles in Org mode and would like to publish a website
and Some of the articles are on a work of literature, for which you would like to include links to its author(s)”

Yes, I write some kind of articles in org mode WITH Org roam. I note for example important people, with a description + what they did. Then I’m interested in other things, like this book. Then I make a description of the book and I can very well link it with this “important” person.
So I have nodes of people, books read, events during the 2nd world war etc. A little like Wikipédia.

" - The links to the author information should be published in a specific layout, probably with using a specific html tag or css class"

Almost right ^^. I don’t care about aesthetics at the moment. I just want to be able to, like in a normal link, click on it and go to a node. And not see [[id:6464565465464][Someoneimportant]] after the export.
But your idea is in my plans :wink:

“Something like this?”

In the final idea, I would like to “have my own wikipedia”, exactly like this:

https://braindump.jethro.dev/

I looked at his Github repository, and indeed he publishes with ox-hugo and converts all his files to markdown with a script, which is really cool. I know the theory, but the practice is still hard for me…
By the way, I hope there will be a good tutorial for this, or even a function integrated directly into Org-Roam: that would be fantastic. If you have ones ^^.

“So… Why do you need the link to the author to be Org-ID based? Is this because you want to use Org-roam? Why don’t you just write your articles in other formats, such as markdown or directly in html? Or use some static site generator such as Hugo that can parse Org — there are other posts on Hugo and publishing in this forum if you search.”

The previous paragraph answers your question ^^

To summarize: I would like to export my Org-roam database which uses nodes, these nodes having IDs (logical) but also other, like for example “Author” or “Date_of_publication”.
Moreover, in these properties, there are links to other nodes, such as authors. However, when exporting, the link that is in html or md is not the right one, but only displays [[id:oneID][OneAuthor]], and not a clickable link to the node of this person in my database.

Hoping to be clearer now, and thanks again for your answers.

Maybe this, then:

Export

Org Export supports ID links, but requires some additional setup. First, it is recommended to use org-id-track-globally to track all Org IDs. This allows Org export to figure out the file to link to.

To ensure that anchor links directly to the headline are functional, we need to patch ox-html to respect the ID property as the anchor tag. This gist does exactly that.

I had seen this solution before, and I had tested it. I tried it again and… still not :confused:

(
sorry mistake in the screenshot :
What I want
What I want in org properties after export in HTML :
)

My html page looks like this :

To make sure everything is clear ^^:
The rectangle represents the properties of the nodes, so I can add
(with this line : #+OPTIONS: prop:(“Author” “ID” “another_property” etc)
) the ID or anything else to export. And this properties can have a number, a Name or… a link to another node. Unfortunately, when exporting, the link in properties is not usable, unlike the one below (the one that is not in the properties).

I see.

By the looks of it, you will need to code a solution yourself.

I think what is happening is the “link” in the property :auteur: is actually not a link for the Org syntax – nothing to do with Org-roam but Org in general. I think this is the reason why the value of a property is taken literally and gets rendered as is in the HTML.

If this is true, you are going against the standard syntax, so you would need to write your own code. I could think of three options:

  1. Use a pre-processing facility in Org-export where you can insert your own custom piece of code.
  2. Maybe post-process the HTML after it has been generated to convert the ID links to link ankers <a> (within export, or after and outside Emacs)
  3. Use the link in the body of the text like you have in the “What I Want:” part

In any case, I don’t think I can be of much help for this.

I would vote for Option 3 – the easiest and no code needed.

You are right, all the links are “badly exported”.
I tried with this:



:PROPERTIES:
:Auteur: [[id:a79e3627-cc99-4812-9dc0-a6c5e5724a19][Anil Seth]]
:Test: [[file:Archives.org]]
:ID: 895fa9e3-8f37-4d5d-b5fe-94b9815ae7e5
:END:

Author: [[id:a79e3627-cc99-4812-9dc0-a6c5e5724a19][Anil Seth]]

Test: [[file:Archives.org]]

And same result.

  1. I don’t think I have the necessary skills x)
  2. It’s a good idea, I would just have to write a little script in python and that would be it. If I do it one day I will post the script here ^^
  3. It’s not a good solution for me, because I want to be able to make queries in org mode thanks to these properties

Thanks a lot for your answers !