There is a config param in jekyll called production_url. I can\'t find any information on how to use it.
Ideally i would like to be able to generate permalinks with loc
jekyll serve will call jekyll build, so you can't really use those two as a way to output different URL schemes.
I built a Jekyll plugin that does this with a Liquid Filter and one user defined variable in your _config.yml called mode.
You set the mode to development or production and the plugin takes care of the rest in your templates.
So in your template you could have a URL such as:
When mode is development, upon Jekyll build/serve you will get a relative URL:
Locally this would be accessed as: http://0.0.0.0:4000/img/dog.jpg
When mode is production, upon Jekyll build/serve you will get an absolute URL:
The http://www.domain.tld is what you have set in _config.yml -> url variable.
You can see more details on the plugin here:
http://jhaurawachsman.com/2013/jekyll-url-helper-filter-plugin/