Search code examples
githubjekyllgithub-pages

My jekyll blog won't render properly when hosted on Github pages


I'm on a Windows 10 machine, a few days ago I downloaded a Jekyll theme to use as my personal portfolio site, after making a branch called gh-pages and pushing it to that branch it is not rendering properly, here is the URL: https://nezmustafa123.github.io/blog/

Does anyone know what could be causing this?


Solution

  • There is a problem on your site URL configuration, instead of loading the CSS from https://nezmustafa123.github.io/blog/assets/css/main.css it is looking for http://localhost:4000/assets/css/main.css.

    In the configuration file _config.yml chenge the following key to your website domain:

    url: http://localhost:4000
    

    and add the baseurl: baseurl: "blog".

    Then adjust your head includes using site.url to use the base_url prefix in _includes/head.html or generate the absolute path including the url with absolute_url:

     <link rel="stylesheet" type="text/css" href="{{ "/assets/css/main.css" | relative_url }}">
    

    Relative URL

    Prepend the baseurl value to the input. Useful if your site is hosted at a subpath rather than the root of the domain.

    Absolute URL

    Prepend the url and baseurl value to the input.