Question

I'm using gh-pages for depoyment for my jekyll site.

I've been trying to develop without having to delete/add the {{ site.baseurl }} paths back in before all the css, js, and img files for my sources every time I want to serve jekyll locally.

I'm getting a little stuck here as everyone says to pass an empty string like this:

jekyll serve --baseurl ""

But when I do this it generates the site ok but returns:

error: can't dup TrueClass. Use --trace to view backtrace

Can't seem to understand why I would be getting this error.

My _config.yml looks more or less like this:

url: "http://myjekyllsite.github.io/"
baseurl: "/my-baseurl"

I've linked my js and css files as well as added the path to my images like so:

<img src="{{ site.baseurl }}/img/image1.jpg">

The only plugin I'm using is jekyll-sass

Any ideas?

Was it helpful?

Solution

I didn't find a traditional way to fix the dup TrueClass, but I found a good enough way around it so I can develop locally without having to switch those paths each time.

In the guide for gh-pages to jekyll here: http://jekyllrb.com/docs/github-pages/

They specifically state to not have a trailing slash on your baseurl in your _config.yml. I found by not following their advice and using a trailing slash in _config.yml like so:

baseurl: /my-path/

I could have all my other links still use the {{ site.baseurl }} path just without the leading slash and use:

jekyll serve --baseurl '/' -w

So all my paths work just fine. Example:

<link rel="stylesheet" href="{{ site.baseurl }}css/sytle.css">

That way it works when I push up to gh-pages too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top