Jekyll SEO inserts localhost URLs in metadata

When I deploy my site, instead of the Open Graph or Twitter metadata for posts, I’m seeing localhost URLs instead. Could this be a configuration issue or is it somehow related to Jekyll SEO?

My _config.yml is here.

Yes I think what’s going on is Jekyll SEO is using the host and port values from your _config.yml, though not sure why (maybe a bug?) since my understanding those are only used for the local server when running jekyll serve.

host:        0.0.0.0
port:        4000

To get around this you might have to remove those values from your _config.yml and create a development config file and use that locally.

It’s pretty easy to do, you’d just create something like _config.dev.yml add just those two lines and then spin up Jekyll with jekyll serve --config _config.yml,_config.dev.yml

You can load multiple config files… the last one overrides the preceding values.

Think I know what you issue is. You’re likely running jekyll serve then deploying your files via rsync. Jekyll’s serve command overrides your url and adds the host and port values to URL’s that use Jekyll’s absolute_url filter… which Jekyll SEO Tag does.

You’ll want to make sure you are always running jekyll build before doing a deployment. This will give you the correct URL’s in all of the OG and Twitter card markup generated from that plugin.

Shit, you’re right.

I had separated build and deploy partially to make sure I wasn’t generating the site a second time before rsyncing things (repeat items and things of that sort). I did have to fix some URLs going to the wrong place, so that’s on me not realizing things needed to be changed.

For Jekyll Feed, I wonder if something needs to be shown (doctor?) so that this is more explicit about what should be done. I would guess that automating deploys by chaining things together is fairly common. :thinking:

One other thing to be on the look out for, appears there’s going to be a breaking change in an upcoming release of Jekyll.

https://github.com/jekyll/jekyll/pull/7042

jekyll serve and jekyll build will both override the url to localhost unless you specifically set Jekyll’s environment variable to JEKYLL_ENV=production

You might want to add that to your Gulp tasks now so you’re covered in the future when that rolls out.