Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This problem arises because the root directory is always the user url (user.github.com), in both user and project pages. I found a solution to this: Configure the <code>url</code> variable in the <code>_config.yml</code> file to the github project page:</p> <pre><code>safe: true ... url: "http://user.github.io/project-name" </code></pre> <p>then, in the layouts, use absolute references, using the <code>site.url</code> variable to do that:</p> <pre><code>&lt;link rel="stylesheet" href="{{ site.url }}/css/styles.css"&gt; </code></pre> <p>and run the server using:</p> <pre><code>$jekyll --server --url=http://localhost:4000 </code></pre> <p>The command line option overwrite the setting in the configuration file in local mode. With those settings, I get all the links pointing to the right place, both hosted in github and in local mode. </p> <hr> <p><strong>UPDATE: Jekyll 1.0</strong> Since Jekyll reached 1.0, the aforemetioned options <code>server</code> and <code>url</code> and its respective command line options <code>--server</code> and <code>--url</code> have been deprecated. Instructions for the new version:</p> <p>In the <code>_config.yml</code> file, add the variable <code>baseurl</code> (without trailing slash):</p> <pre><code>baseurl: "http://user.github.io/project-name" </code></pre> <p>In the layouts or pages, use absolute references, using the <code>site.baseurl</code> variable:</p> <pre><code>&lt;link rel="stylesheet" href="{{ site.baseurl }}/css/styles.css"&gt; </code></pre> <p>and then, run the local server (the baseurl option is empty on purpose):</p> <pre><code>$ jekyll serve --watch --baseurl= </code></pre> <p>More details about the changes in the <a href="http://jekyllrb.com/docs/upgrading/">docs</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload