emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: inkbottle <inkbottle007@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Internal link broken when publishing (was org-id with ox-html)
Date: Tue, 17 Aug 2021 05:11:35 +0200	[thread overview]
Message-ID: <3332691.axgivObTmJ@pluto> (raw)
In-Reply-To: <1689837.tl16BRLKSx@pluto>

I've done a lot of investigation.

I totally agree with internal links not being stable through publishing:
`3c5997f1-205a-437e-8722-d5f52239a207` => `"bye.org#orgfa9c151"`

I totally agree with what Nicolas Goaziou says there:
https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg01254.html

However, I do have an _internal link_ in the form:
`[[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]`
(This link is not hand made at all, it is the result of: `org-id-get-create` 
`org-store-link` `org-insert-link`.)

Which is translated into:
`<a href="bye.org#ID-3c5997f1-205a-437e-8722-d5f52239a207">bye</a>`

But no target of the corresponding form is created, and that somewhat in 
accordance with the cited post above. But it breaks the link.

As I understand it, in accordance with the cited post, the internal link 
should be "interpreted" as:
`<a href="bye.org#orgfa9c151">bye</a>`
(from: `[[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]`).

For that, there should be some "translation table":
`3c5997f1-205a-437e-8722-d5f52239a207 => bye.org#orgfa9c151`
(there might already such translation table somewhere).
(Actually it is `cache`, in
https://github.com/emacsmirror/org/blob/master/lisp/ox.el#L4442)

The obvious workaround would be to use `CUSTOM_ID`, which is stable through 
publishing. But it's not at all a functionality I'm looking for.
I've thought of a function using `org-map-entries`, creating a `:CUSTOM_ID:` 
as a duplicate of `:ID:` everywhere, creating the `:ID:` if necessary. Always 
using `org-id-get-create`.

But maybe there is an _obvious way_ to have it working out of the box.
Here is a minimal example:

## file: hello.org

* hello
  :PROPERTIES:
  :ID:       e54113f9-2ad7-4a86-94be-68ffc696de0b
  :END:

  [[id:3c5997f1-205a-437e-8722-d5f52239a207][bye]]

## file: bye.org

* bye
  :PROPERTIES:
  :ID:       3c5997f1-205a-437e-8722-d5f52239a207
  :END:

Thanks,
Chris

P.S. I'm pretty sure the minimal example above can work right out of the box 
with someone, who unlike me, knows how to correctly configure the publishing. 
However, I mention two other leads, the first one I prefer by far: (to be 
honest this first one it is not about internal links not breaking at publishing 
time, which was a "given", but to form more "meaningful" publishing id)
1. Suggestions have been made by Nicolas Goaziou to look in the direction of 
`org-export-get-reference` (at the level of the "translation table"?)
https://github.com/emacsmirror/org/blob/master/lisp/ox.el#L4443
2. Another suggestion is from org-roam
https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2#export
https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132




  reply	other threads:[~2021-08-17  3:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 22:28 org-id with ox-html inkbottle
2021-08-14  0:50 ` inkbottle
2021-08-14  4:20   ` inkbottle
2021-08-17  3:11     ` inkbottle [this message]
2021-08-22 20:42       ` Internal link broken when publishing (was org-id with ox-html) inkbottle
2021-08-24 15:23         ` Maxim Nikulin
2021-09-07 15:46           ` chris
2021-09-14 16:33             ` Max Nikulin
2021-09-20  0:05               ` chris
2021-09-20 14:13                 ` Max Nikulin
2021-09-20 15:26                   ` chris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3332691.axgivObTmJ@pluto \
    --to=inkbottle007@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).