> > Hi, Earl, > > Thanks for proposing a solution! I think maybe there's a better way, > though. > > Earl Chase <[email protected]> writes: > > Subject: [PATCH] ol.el: New link type for relative urls > > I think 'relative urls' is a bit of a misnomer here, since regular Org > links handle /folder-relative/ urls just fine. What can trip the user up > when publishing, and the real problem that this patch addresses, is > /root-relative/ paths starting with a slash, which get exported to HTML as > "file://" URLs instead of relative to the server root. If we do end up > using a new link type as the solution, I think this should be reflected > in the documentation (and perhaps in the name of the link type).
I agree, perhaps simply "url" would be a better name. I will add that while this patch is mostly useful for root relative urls, with this new link type, you can also export links like "examples/babel.org". Links like "examples/babel.org" can't be exported unless you prefix them with file: anyways. > > Links that start with 'rel-url' followed by a colon will be treated > > as relative urls. When these links are exported to markdown or HTML > > documents, they are properly converted into relative URL links. I have > > added an open function that will request a base URL when called so that > > users > > will still have the option to open these URLs as they would with absolute > > URLs. > > I'm not sure a new link type is the best approach. If you wanted to add > this link the simple way, with 'C-u C-c C-l', you'd need to edit out the > 'file:~/path/to/folder' bit afterwards. And then, in order to follow the > link between Org files, the user needs to supply the base URL they had > to edit out in the previous step. I don't understand what you are saying here. If you have an absolute url, why would you convert it into a relative url? This is for people who would like to just write a relative url. I would be open to adding a key binding specifically for this link type as well as completion code. I would also be open to adding code that automatically detected a base url from a header or file property drawer, so that the user didn't always have to enter the base url. This is just the base implementation, I didn't want to add any more code until I got confirmation that this was an acceptable solution. > I think a better solution to this problem is to export ordinary file > links in such a way that the local file path to the base directory > (containing the Org source files for the web pages) is replaced with > "/". This could be done automatically for any links matching the > :base-directory of a current publishing process, as well as any other > directories listed in a new user variable. I understand what you are saying, but I really wanted to avoid this approach. First, I want to give users the ability to mix the current behavior and my new addition without having to use another custom variable. This way we can take advantage of the fact that users know exactly which links should be treated as relative urls ahead of time and allow ox to just focus on exporting. > I just sent a reply expanding on this to Khalid's original FR: > https://list.orgmode.org/[email protected] > > What do you think? > > > Regards, > Christian
