Search code examples
markdownjekyllgithub-pages

Not able to display images in Jekyll's posts


In my Jekyll blog I have a collection called _documents where I publish posts that are more important than the usual. I am able to publish images in these posts with the code ![](./../assets/images/test.png) since I am using markdown. Since the publication date of this post is not important the name of the files do not start with a date.

Then I have the standard posts in the folder _posts. When I try to publish an image in those the URL gets changed by adding the year and the month before. For example, what should be https://name.github.io/blog/assets/images/test.png is https://name.github.io/blog/2020/04/assets/images/test.png and the image does not load.

How can I make sure that Jekyll does not use the date when referencing images? Thanks


Solution

  • Try setting the markdown to:

    ![](/assets/images/test.png)
    

    If that doesn't work, see if there are any errors in the console (F12), like a 404 Not Found error on the image.