daattali / beautiful-jekyll

✨ Build a beautiful and simple website in literally minutes. Demo at https://beautifuljekyll.com

Home Page:https://beautifuljekyll.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Images not working on post pages

natan-dias opened this issue · comments

Hello all.

I am not able to put images to my markdown posts, following your example post page. In my case, the code is:

![diagrama01](/assets/img/post-img/ssh-tunnels-post/diagrama01.jpg)

But for some reason, my post is only with the "diagrama01" word on it. Is there any way to post images in the markdown posts?

Kind regards.

I'm surprised nobody ever reported this. It's actually a jekyll issue, you can read about it here. The problem is that with project sites (eg. natan-dias/devops-collab) as opposed to user sites (eg. natan-dias/natan-dias.github.io) the URLs need to be prefixed by the project name (eg. devops-collab). Any place where this happens within the template - such as the YAML - I already took care of it for you by running all URLs through a relative_url jekyll filter.

But any URL that you create yourself (whether it's an image or a CSS file or even just a link) assumes that a leading / goes to the base website - without the project name. So you'll need to either change any link to

![diagrama01](/devops-collab/assets/img/post-img/ssh-tunnels-post/diagrama01.jpg)

or

![diagrama01]( {{ "/assets/img/post-img/ssh-tunnels-post/diagrama01.jpg" | relative_url }} )

The second one is preferable because it should work always, whereas the first one depends on the exact name of your project. Unfortunately there's nothing I can do from beautifuljekyll to fix this automatically.

Looking at many past users, it seems like most people troubleshooted this and independenly arrived at the first solution but just never contacted me about this. I will add documentation to mention both solutions. Thanks for reporting.

Please let me know if this fixes it for you.

Hey, thank you very much. I used the second option and it works like a charm.

I had been looking for that in your past issues, but I decided to open that, in fact, because I didn't find anything related to that.

Thanks!!

I think we are good to close this issue. Thank you very much!