How can I replace localhost in my _site folder?


I’m having a problem that when I run Jekyll Build—some images aren’t loading. In Chrome Console, I see


in my page’s

Here’s my repository:
and my live site:


Hello Chris,
Looks like you are looking at the cached website of your ISP. If you upload the files to the server it takes some time before the cache of the ISP is refreshed. Can be some hours.

Probably you first uploaded the _site-files that were generated after a `jekyll serve’. After that you did a ‘jekyll build’ and uploaded the files again.
You can check if the files you uploaded also contain the localhost reference, if not then you are okay and have to wait until the cache of the ISP is refreshed.

You can bypass the ISP cache by using a proxy that does not cache. I don know any (free) proxy and did not use this way of working (yet).
See also


5 days have gone by and still same issue. I don’t think it’s a cache issue but possibly something in my code.

In my , I have the following code:

<meta name="twitter:image" content="{{ site.url }}{% if page.og_image %}{{ page.og_image | asset_path }}{% else %}{% asset_path og-image.jpg %}{% endif %}">

It seems the

.site.url is what is causing the issue but I’m not quite sure how to fix.


If you run bundle exec jekyll serve, your {{ site.url }} will get rendered into http://localhost:4000 automatically.
Instead run either of the following:

bundle exec jekyll build


JEKYLL_ENV=production bundle exec jekyll serve

# if you're on Windows, then
set JEKYLL_ENV=production
bundle exec jekyll serve