Kitty image is missing in 'Welcome to Jekyll' post but shown at index.md and about.md

216 Views Asked by At

My goal is to display an image in posts using Jekyll + Github Pages. I ran into 404 error and the image did not show. My repo is at https://github.com/kuolai/blogubb. The site is at https://kuolai.github.io/blogubb. If you go to the site, you will see a kitty image at the home page. But if you go to the post Welcome to Jekyll, there is no image!!

Steps I did to create remote repo and the site:

  1. gihub.com/new to create a remote repo
  2. The local repo was created with jekyll new blogubb
  3. _config.yml with one line change `baseurl: "blogubb"
  4. The photo is a cute kitty stored in assets/img/kitty.png
  5. The only post, the default post, 2021-11-13-welcome-to-jekyll.markdown, with one line added ![](/assets/img/kitty.png)
  6. git checkout -b "gh-pages"
  7. git remote add origin .../blogubb.git
  8. git push origin gh-pages

Other than kitty image not shown in Welcome to Jekyll post, everything looks good. I also tried

The error message from the console of Chrome DevTools:

GET https://kuolai.github.io/assets/img/kitty.png 404
welcome-to-jekyll.html:50  

To make a minimum case, I was able to re-create the problem with minimal lines of changes. Please help.

1

There are 1 best solutions below

0
kuolai shu On

I solved it. Replace

![](/assets/img/kitty.png)

with

![]({{"/assets/img/kitty.png" | relative_url }} )

The document of Liquid Filters is in https://jekyllrb.com/docs/liquid/filters/