Jekyll site.url Setting

When running jekyll serve in your local development environment Jekyll, by default, forces the value of site.url to http://localhost:4000 irrespective of the value of url: in your _config.yml file.

This is because, internally, the value of JEKYLL_ENV is set to development. This is a pain if you want to deploy the contents of your _site file to your production webserver. You don't want your {{ site.url }} references to be http://localhost:4000 in production do you!

To force Jekyll to respect your _config.yml setting for site.url, start Jekyll like this: JEKYLL_ENV=not-development jekyll serve.

The value of JEKYLL_ENV can be anything apart from development and it will work.