Search code examples
rubyblogsjekyllwebrick

CSS/images not being loaded in Jekyll blog


I am new to Jekyll and just trying to start a Jekyll Theme example. I tried a few other themes too and all of them only load up at port 4000 with basic text and no images/styling.

  • Fork the project.
  • Clone the repo in my local machine
  • bundle install
  • jekyll serve

The server starts and I can look at the page but it is very ugly without the styling.

I know I can change the variables and configurations but I just wanted to run this as it is first. I can see all the images and in the images folder but why is this not being loaded on the blog?

I am new to Jekyll so please let me know if there is something wrong with this. Jekyll serve is the correct way to start the server right?


Solution

  • Have you updated the URL in _config.yml? This is used to build the links to the CSS and scripts.

    When working locally you should comment it out. If you haven't already open _config.yml and change

    url:              http://your-site.com
    

    to

    #url:              http://your-site.com
    

    When you publish to a live site uncomment the line and update the url.