Reputation: 41
can anyone help me figure out why site.url does NOT change to http://localhost:4000
per the documentation? It mirrors the url param in _config.yml. I have checked and jekyll.environment = development.
I have spun up a new Jekyll project on a different machine and the results are the same.
Upvotes: 2
Views: 795
Reputation: 41
This feature has been disabled in version 4.2.0. What a waste of time this has been.
Upvotes: 2
Reputation: 1323553
That documentation does mention:
It will not be set if you set
JEKYLL_ENV=production
and runjekyll serve
.If
JEKYLL_ENV
is any value exceptdevelopment
(its default value), Jekyll will not overwrite the value of URL in your config.
And again, this only applies to serving, not to building.
So double-check your JEKYLL_ENV
value, and your command (jekyll serve
)
The OP points out to jekyll/jekyll
PR 7253 in jekyll v4.2.0
Local tests show that the local preview server is based on
config["host"]
andconfig["port"]
values.. So even ifconfig["url"] == https://jekyllrb.com
, the site will be served at the default setting://127.0.0.1:4000
This simplifies users' workflow by not having to build the site again with
JEKYLL_ENV=production
(unless their templates are designed to render differently for the two ENV vars, which is a different story altogether)
This, however, is in the process of being reverted: PR 8620
The documentation on jekyllrb.org was not updated to reflect this change in behavior,
That change did not affect cases where the local server URL was explicitly set via
bundle exec jekyll serve --host localhost --port 4000
to belocalhost:4000
, or when it was set to be any other combination of hosts or ports.That change only affected the default
jekyll serve
, which is the local development action recommended in the Jekyll docs.
So this could be a workaround in your case:
bundle exec jekyll serve --host localhost --port 4000
Upvotes: 0