Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll theme does not work on GitHub Pages but works locally

I've been struggling with this for a few hours now, to no avail. I'm trying to use one of the supported GitHub Pages themes (Cayman) in my docs site and I'm having a ton of trouble. The site looks great when I run it locally using bundle exec jekyll serve --safe (I read that GitHub uses the safe flag) but on GitHub it doesn't show any theme.

Gemfile:

source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

_config.yml:

title: myproject
baseurl: "/myproject"
url: ""
markdown: kramdown
theme: jekyll-theme-cayman
exclude: [vendor]

index.md:

---
layout: default
---
This is the home page of the myproject documentation.

The site appears fine when run locally, but the version on GitHub Pages (https://myusername.github.io/myproject) has no theme. Any ideas?

UPDATE:
It seems as though the site is not reloading the _config.yml. I changed multiple settings (such as the title) and still have not seen the changes reflected in the github page, but they are reflected locally. I have also disabled caching on that page, so it is not loading an old version. GitHub says it is rebuilding the site next to each commit, and changes to the markdown show up, just not the _config.yml.

like image 203
lauren Avatar asked Jan 10 '18 23:01

lauren


3 Answers

My mistake was to make in _config:

baseurl: ""

When I REMOVED it, all started working fine!

like image 113
Yshmarov Avatar answered Oct 08 '22 21:10

Yshmarov


I recently suffered from the same problem. When I was deploying my Jekyll project on GitHub pages.

So when I visited my website hosted by GitHub pages, I found that my theme was missing and surprisingly I see some weird broken design.

Solution :
Here is what I have done, firstly I have opened the logs on my chrome. You can do that by just clicking inspect option. Where I found that my sass files are not found. When I found my link from where my site is searching for the files. The problem is here. Earlier my website used to be in the format as you mentioned https://myusername.github.io/myproject but now I simply hosted my project directly on my repo in this format https://myusername.github.io/ then it worked for me. It means I didn't create another repo using another name. Eventually, I did it directly on the repo - myusername.github.io

Please check this deployment using Github pages and you can easily solve the problem. And can deploy as you wish

like image 3
Mehant Kammakomati Avatar answered Oct 08 '22 23:10

Mehant Kammakomati


Edit your config .yml

  1. Make sure the base URL is following this format: baseurl: "/blogjekyll" # the subpath of your site, e.g. /blog

  2. Make sure URL is following this format: url: "https://berthaamelia.github.io" # the base hostname & protocol for your site, e.g. http://example.com

enter image description here

like image 3
bertha Avatar answered Oct 08 '22 21:10

bertha