TL;DR: Don't use baseurl. It'll drive you crazy.
Hey, so there's been a bit of confusion about what the Jekyll configuration option called
baseurl is. Part of the beauty of open-source and of Jekyll is that there's a lot of flexibility. Unfortunately, much of this flexibility doesn't apply to
baseurl. Here's a quick distillation of its intentions, and how to use it.
Mimic GitHub Pages
So let's say I come up with a cool new project. I want to make documentation for a project I'm working on called "ubiqity", and I'll be deploying it to GitHub Pages as a repo under my username, "@parkr". Its documentation will be available at the URL
In this example, the term "base URL" refers to
ubiquity. When I go to develop my website, I can set the
baseurl key to equal
ubiquity and navigate my website from
http://localhost:4000/ubiquity/, as though it were hosted on GitHub Pages. Notice that the only difference here between development and production is the host:
Configuring Your Site Properly
_config.ymlto match the production URL without the host (e.g.
jekyll serve -wand go to
your_baseurlwith whatever you set
baseurlto in your
_config.yml, and not forgetting the trailing slash.
- Make sure everything works. Feel free to prepend your urls with
- Push up to your host and see that everything works there, too!
You've done it! You've successfully used
baseurl and the world is wonderful.