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: Brett Viren
Subject: Re: [O] why prepend "file://" to abs paths in html output?
Date: Mon, 10 Jul 2017 09:58:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi Nicolas,

Nicolas Goaziou <address@hidden> writes:

> So, basically, upon exporting the following document to HTML:
>
>   #+html_link_root: /tmp/
>   [[/tmp/unicorn.jpg]]
>
> the link becomes
>
>   <img src="/unicorn.jpg" alt="unicorn.jpg" />

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.

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

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

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

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

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

into either:

  <img src="/mysiteroot/images/unicorn.jpg" ...>

or:

  <img src="../../images/unicorn.jpg" ...>

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]]


-Brett.

PS: imo, in this example, I think the real solution is to make Nikola
allow for keeping org+img source together and to output org+img+html all
together in one web directory.

Attachment: signature.asc
Description: PGP signature


reply via email to

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