Absolute_url rendering links as http://localhost?

For some reason, whenever I use {{ absolute_url }} in my templates, but the links render as http://localhost:4000. I have my website’s url in the _config.yml file as url: "https://www.mywebsite.com" and baseurl: "" is left empty. Any thoughts on what could be happening here? I build the site locally with bundle exec jekyll s, and then upload the everything to my server afterwards. I’m using jekyll 4.0.0. I’m also using a fork of the following template for my site:

Figured it out, finally. You have to use the production environment variable when building the site. Here’s what I used.

JEKYLL_ENV="production" bundle exec jekyll build

did you try build without the production flag? serve is meant for local dev so it does a few things differently than build.