Hey guys,
Im trying to display images in a blog post, and Im struggling with the syntax (i.e. I have figured out how to do it but it seems very verbose) and Im wondering if anyone has a better / cleaner solution to include images in posts.
I have Directory Indexes enabled, and I place my images in a subdirectory with the same name as the post (as described in the middleman documentation).
The only way I can successfully display this image is:
<img src="./ArticleName/ImageName.png" alt="">
or in Markdown:
![](./ArticleName/ImageName.png)
Now this seems relatively short, but my article titles end up being pretty long making the actual result look like this
<img src="./PYXL_Behind_the_Scenes-_From_Sketchbook_to_iOS_app/photo-1.jpg" alt="">
Ideally I would love to just use a rails helper and have it recognize relative assets properly and just be able to do
<%= image_tag (photo-1.jog) %>
or even just directly refer to the image via the html tag (without having to include the relative path to the image.
Has anyone figured out how to do this? Is there any helper function out there I could use to implement this?
Thanks guys!