0

I need to get a relative url in the data-original attribute of img tag like this:

<img data-original="../imf/72932.png" src="../i/72932.jpg" />

But I'm getting

<img data-original="/imf/10163.jpg" src="../i/10163.jpg" /> 

As you can see, by setting set :relative_links, true in config.rb I can get a relative link in img's src but not in the data-original attribute with:

<%= image_tag  img_url,   {  "data-original" => original_path }  %>

where original-path is defined like this

<% original-path = "/imf/#{ wiz.file }"   %>

It works of course when the site is generated dynamically in development but not when it is built statically. Is there any way to make original_path work like a relative path?

helcim
  • 789
  • 13
  • 27
  • There is a workaround described in [Deployment on a sub-Uri](http://ict4g.net/adolfo/notes/2014/10/30/switching-to-middleman.html#deployment-on-a-sub-uri) but that's not exactly what I'm after as it requires per site configuration so this setup in not 100% relative. – helcim Dec 10 '17 at 17:16
  • P.S. The `:http_prefix` seems to conflict with something. It works when you rename it to something else – helcim Dec 10 '17 at 17:23

0 Answers0