How to detemine if jekyll running locally or in production site? -
there config param in jekyll called production_url. can't find information on how use it.
ideally able generate permalinks local url when being run serve param , production url when run build param.
how that?
jekyll serve call jekyll build, can't use 2 way output different url schemes.
i built jekyll plugin liquid filter , 1 user defined variable in _config.yml called mode.
you set mode development or production , plugin takes care of rest in templates.
so in template have url such as:
<img src="{{ '/img/dog.jpg' | to_absurl }}" /> when mode development, upon jekyll build/serve relative url:
<img src="/img/dog.jpg" /> locally accessed as: http://0.0.0.0:4000/img/dog.jpg
when mode production, upon jekyll build/serve absolute url:
<img src="http://www.domain.tld/img/dog.jpg" /> the http://www.domain.tld have set in _config.yml -> url variable.
you can see more details on plugin here:
http://jhaurawachsman.com/2013/jekyll-url-helper-filter-plugin/
Comments
Post a Comment