New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong URLs in Generated Files #4

vermont42 opened this Issue Jan 12, 2019 · 3 comments


None yet
2 participants
Copy link

vermont42 commented Jan 12, 2019

This blog has RSS enabled. In my RSS reader, until I implemented a workaround today, the post URLs in my RSS feed were incorrect. Here is an example URL I saw in my feed reader: http://localhost:4000/blog/more-reviews/ The URL should have been

I don't know much about RSS, but I suspect that the problem was that the feed.xml that Jekyll generated had localhost:4000 rather than My defective feed.xml is excerpted below. FWIW, my feed.json, robots.txt, and various html files also had localhost:4000 rather than

As a temporary workaround, I ran the following commands today before uploading to S3. This fixed the problem, but I would be grateful if @jessesquires could provide insight as to how to get Jekyll to put the correct URLs in files.


find . -type f -name '*.html' -exec sed -i '' s/localhost:4000/ {} +
find . -type f -name '*.xml' -exec sed -i '' s/localhost:4000/ {} +
find . -type f -name '*.json' -exec sed -i '' s/localhost:4000/ {} +
find . -type f -name '*.txt' -exec sed -i '' s/localhost:4000/ {} +

feed.xml Excerpt

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
    <title>Race Condition</title>
    <subtitle>A Blog by Josh Adams</subtitle>
    <link href="http://localhost:4000/feed.xml" rel="self" />
    <link href="http://localhost:4000" />

        <name>Josh Adams</name>


    <category term="programming"/>
    <category term="ios"/>
    <category term="swift"/>
    <category term="objective-c"/>
    <category term="software"/>
    <category term="mobile"/>

        <link href="http://localhost:4000/blog/more-reviews/" />
        <title>Ratings and Reviews</title>
        <subtitle>How to Get More of Them</subtitle>


        <summary><p>This blog post describes two techniques for getting more ratings and reviews.</p>

This comment has been minimized.

Copy link

jessesquires commented Jan 12, 2019

hey @vermont42 👋

Ok, so everything appears to be setup correctly.

The correct site.url is specified in your config:

And that's what's referenced in your feed.xml:

The question is, how are you deploying your site?

It looks like you are not using GitHub pages for hosting, correct?

It appears like your workflow is probably something like:

  1. write and build the site locally using bundle exec jekyll serve
  2. wherever you host, dump the contents of _site/ once you're ready.

This would cause the http://localhost:4000/ problem. You should just be running bundle exec jekyll build, then deploying. But before you do, you can check the contents of _site/ and see if everything is generated correctly.

Is that what's happening?

I'd recommend deploying via Git. I wrote about this here. There are lots of details that won't matter for you. The relevant parts are (1) hosting your git repo on your server, (2) setting up git hooks to run jekyll build and dump _site/ into your public www directory. Then you can git push to your server and everything should just work™️

Hope this helps! 😄


This comment has been minimized.

Copy link
Owner Author

vermont42 commented Jan 12, 2019

You are correct! I did not realize that bundle exec jekyll serve puts localhost in all the files, but in retrospect, that makes sense. How else could my browser see files in localhost? I need to just bundle exec jekyll build and then deploy to S3.

Much appreciated.

In future, I will deploy via Git hook.

@vermont42 vermont42 closed this Jan 12, 2019


This comment has been minimized.

Copy link

jessesquires commented Jan 13, 2019

Awesome! 👏 I'm glad it's fixed! 💪

Thanks for the kind words @vermont42 ! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment