Image Path when the file isn't in the root #23413
-
Hello When i have my image in a folder named “Image” and my file “sample.md” is in the Root, then i access the picture “pix.jpg” with the path “image\pix.jpg”. But how i access the the picture, when the file “sample.md” is in a subfolder? That means “sample.md” ist in the folder “/_posts” and the pictures are in the folder “/image”. I tryed with the prefix “[repository]/image/pix.jpg”. Nothing works. Please a little information to solve my confusion. Greetings |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Hey there @petergyger, help’s arrived. You can reference static files (like images) to your Jekyll posts by adding it them to a subdirectory like /assets and then referencing that in Markdown: . There’s some more info on this over here: https://jekyllrb.com/docs/posts/#including-images-and-resources 🙂 Let me know how you go |
Beta Was this translation helpful? Give feedback.
-
Hello So sorry - but don’t work. the Directory Structure: [Repro Test] ¦-_posts ¦-images In the directory “_posts” is a markdown file “sample.md”. In this file i link the Image “pic.jpg” from the Folder “images”. How? There is no way that work. I habe no Problems, when the Markdown File is in the Root and i write a static link to “images/pic.jpg”. I read the Jeckyll Manual and i followed your link. But for my question there is no solution. Greetings Peter |
Beta Was this translation helpful? Give feedback.
-
Thanks for letting me know @petergyger, Let’s check if adding a forward slash before the reference helps. For example:
If that doesn’t help, let’s check if adding " …" to before the first forward slash helps:
|
Beta Was this translation helpful? Give feedback.
-
The path of the link in github markdown follow the linux convention, so the second example that give @timrossback should work. If not you can give to us the tree of the projects/repository and we can help in a better way. There is another way to link image, using the absolute path like this:
-Gabriele- |
Beta Was this translation helpful? Give feedback.
-
Hello You win :slight_smile: I use the two dots and the Problem was solved. Thank you very match for your kind help Greetings Peter |
Beta Was this translation helpful? Give feedback.
-
You’re more than welcome @petergyger! If you need a hand with anything else, just let me know or feel free to post a new thread in the Conversations board 🌟 Have a great day! |
Beta Was this translation helpful? Give feedback.
-
Hi All I am also facing the issue for relative link. following the same structre as above , only diffence is i need to link .md file from _pages/ to _posts/.md. i can see .md file https://aartirajput1.github.io/JekyllSiteRepo/JekyllSiteRepo/adding/ but not rendedered in HTML , its showing 404 error not found. _post/.md file : https://github.com/aartirajput1/JekyllSiteRepo/blob/master/_posts/2019-04-05-Homepage.markdown Please help. Thanks in advance :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Same issue here. |
Beta Was this translation helpful? Give feedback.
-
Here’s one method I use frequently. Whenever I need to fetch an image from somewhere. I don’t save it in the root folder. Instead what I do is I try to upload it somewhere and take the image address from there to fetch directly. The one service I use is the google blogger. Where I’ve created a blog, where I create draft posts for saving images online. And by right-clicking, I can get the image address. I think this might be helpful for you. Source: ExactlyHowLong |
Beta Was this translation helpful? Give feedback.
Thanks for letting me know @petergyger,
Let’s check if adding a forward slash before the reference helps. For example:
If that doesn’t help, let’s check if adding " …" to before the first forward slash helps: