From: Nicolas Goaziou <email@example.com> To: firstname.lastname@example.org Cc: email@example.com Subject: Re: HTML export uses anchor ids which change on every export Date: Sat, 29 May 2021 21:50:24 +0200 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> (firstname.lastname@example.org's message of "Sat, 29 May 2021 14:18:04 -0400") Hello, email@example.com writes: > HTML export wraps headlines in anchor tags with IDs, so that they can be > linked by suffixing #[anchor-tag-ID] to the URL. > > HTML export used to use anchor IDs like "sec-2" for the second headline, > but at some point it switched to generated IDs like "org7ffb324", which > change on every re-export. > > This means anchor-links on external sites (that is, links which link to > a specific section of an org file) break every time an org file is > re-exported to HTML. The old style of anchor IDs would break URLs when > sections moved around, but at least it wouldn't break on every > re-export! > > This makes org much less useful for typical web publishing use cases. > > This can be worked around by setting CUSTOM_ID for every headline, which > will override the anchor id used, but I think it was much better when it > just worked by default... > > It looks like this was changed in commit > 459033265295723cbfb0fccb3577acbfdc9d0285 > "Export back-ends: Use `org-export-get-reference'" > > Perhaps this functionality (of generating anchor IDs based on the > section number) could be added back in? No, for public links, CUSTOM_ID is the only sane way to handle this. Even "sec-2" could betray you if you slightly modify the document. Regards, -- Nicolas Goaziou
next prev parent reply other threads:[~2021-05-29 19:51 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-29 18:18 sbaugh 2021-05-29 19:50 ` Nicolas Goaziou [this message] 2021-05-29 19:54 ` Timothy 2021-05-29 23:10 ` Tim Cross 2021-05-30 5:16 ` Timothy 2021-05-30 6:56 ` Tim Cross 2021-05-30 12:11 ` Nicolas Goaziou 2021-06-08 23:31 ` Spencer Baugh 2021-06-09 12:19 ` Nicolas Goaziou
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: HTML export uses anchor ids which change on every export' \ /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
Code repositories for project(s) associated with this 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).