How can I replace localhost in my _site folder?


#1

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

http://localhost:4000/feed.xml
http://localhost:4000/posts/

in my page’s

Here’s my repository: https://github.com/christiantype/christian-thoughts
and my live site: http://christiansolorzano.com/


#2

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 https://help.fasthosts.co.uk/app/answers/detail/a_id/495/~/delays-in-viewing-updates-to-a-website#isp


#3

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.


#4

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

or

JEKYLL_ENV=production bundle exec jekyll serve

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