emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] why prepend "file://" to abs paths in html output?


From: Kaushal Modi
Subject: Re: [O] why prepend "file://" to abs paths in html output?
Date: Mon, 10 Jul 2017 19:54:58 +0000

Hi Nicolas,

I tried out the patch, and my comments are in the MWE below.

On Mon, Jul 10, 2017 at 9:59 AM Brett Viren <address@hidden> wrote:
Is this saying "subtract the value of 'html_link_root' from the Org link
to make its URL"?

If so, I think this would not be general enough to help some cases.  For
example, with Nikola+orgmode and with Nikola's "pretty URLs" option the
relative location between either the Org source or its generated HTML
and an image that they both link will differ.

Good point. I overlooked that.

I have this MWE that explains the "would like to have" vs "what this patch gives us":

=====
#+TITLE: ox-html root dir
#+OPTIONS: toc:nil
#+STARTUP: inlineimages
#+HTML_LINK_ROOT: /tmp/site/static/

An =image.png= exists as =/tmp/site/static/images/image.png=.

* This is how the image links should have worked with the link root already specified
[[/images/image.png]]
- The =HTML_LINK_ROOT= should to appended to the front of the above link if that
  concatenated path is a valid one.
- Would also like =C-x C-o=, inline image display, etc. to work.
- So a thought.. should the link root specification be made exporter agnostic?
* This works after adding support for ="" ..
.. but
- The link path becomes too long.
- Need to hard-code the full path to the site/blog root directory before each of
  such links.
[[file:/tmp/site/static/images/image.png]]
=====

 
Some details:

Nikola source wants this layout:

  /path/to/my/nikola/posts/my-blog-post.org
  /path/to/my/nikola/images/unicorn.jpg

The Org source generates to HTML which will be found at this URL path:

  /mysiteroot/posts/my-blog-post/index.html

The organization for Hugo posts is something similar. So hopefully we can have a solution that works for such blogging platforms in general.
 
In comparsion, the hugo paths would be:

  /path/to/my/hugo/content/posts/my-blog-post.org
  /path/to/my/hugo/static/images/unicorn.jpg

So, right now, either the Org link to the image must be written to be
invalid (for Org):

  [[../../images/unicorn.jpg]]

 Yeah, this is a problem and can probably be fixed if a support for something like "#+LINK_ROOT" can be made in Org and not specific to an exporter backend.

Or, some mechanism needs to turn the valid Org link:

  [[../images/unicorn.jpg]]

into either:

  <img src="" ...>

or:

  <img src="" ...>

I guess I could use html_link_root set to "/path/to/my/nikola" but then
my Org source loses portability.

I think better would be able to explicitly state the desired URL path
for the HTML <img> like:

  #+html_url_path: /mysiteroot/images/unicorn.jpg
  [[../images/unicorn.jpg]]

As I mention in my MWE, I am actually looking for a solution so that we do not need to specify the "mysiteroot" for each link.. may be just one as a "#+LINK_ROOT".
--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]