Hi, I’m using Jekyll and created a post in the _posts folder. The post is an HTML file and saved in the “_posts” folder
I made sure that I did a Jekyll Build command and a Jekyll server command. Then I went to http://localhost:4000/2017/08/01/bills-lindyhike.html I made sure that the jpg file is in the same folder as the HTML post file. No matter what I do, the link to the photo is always broken. What am I missing here? How do I install photos into the Jekyll Blogs?
If you just put an image into the _posts folder, I really don’t know what would happen to it, my guess is that it wouldn’t do anything, jekyll is only processing html or md files that are named with the date.
Normally I would put an image into /assets/img in the root, then reference that path in the img tag like
Though you could put the image in other places, I have read about some people trying to keep the post together with its images, but I don’t remember how they did it. My sites are not post oriented so I just pile them all into assets/img and occasionally use sub folders in there to separate certain types of images as needed.
I keep getting the following messages that the jpg is not found. All I
did was create an html post within the * _post* folder and then put the
photo in the same folder.
As @rdyar mentioned above, Jekyll by default doesn’t copy assets placed in the _posts folder… that’s why your image is missing after build.
You’ll need to place it in another folder (not something with an _ underscore). The suggestion above is a good one. Create /assets/images/ in the root of your project and place the image there.
Then in your post you can reference it with either HTML or Markdown
![image](/assets/images/your-image.jpg)
or
<img src="/assets/images/your-image.jpg" alt="">
And if you’re not hosting with GitHub Pages you can use the Jekyll Post Files plugin which allows you to organize your images alongside your posts.
just for clarification: Jekyll does not ignore the underscores, it ignores all content (files or folders) beginning with an underscore.
In all probability everyone knew that already :).