Minimal-mistakes: stiemap.xml shows localhost:4000 everytime I build. Should we change manually to our repo.github.io domain evertime we push to the remote gh-pages branch?

Created on 23 Mar 2017  路  4Comments  路  Source: mmistakes/minimal-mistakes

  • [x] This is a question about using the theme.
  • [ ] This is a feature request.
  • [x] I have updated all gems with bundle update.
  • [x] I have tested locally with bundle exec jekyll build.
  • [ ] I believe this to be a bug with the theme --- not Jekyll, GitHub Pages or one of the bundled plugins.

Environment informations

Version:
-Minimal mistakes - latest

  • Operating System - windows

Expected behavior

bundle exec jekyll serve

  • Builds successfully and generates "sitemap.xml".
  • But sitemap.xml has all localhost:4000

Should the sitemap.xml still contain localhost:4000 even while we push to the gh-pages Github branch?
Or if we need to change to our domain, such as repo.github.io instead of "localhost:4000" manually?

Because, sitemap.xml is rebuilt everytime locally and all links change back to localhost:4000.

Support

Most helpful comment

Oops. Just understood. That serving caused to render it in localhost. Excuse the beginner question.
Thanks anway! :)

And Man! Thanks for such a nice theme.

All 4 comments

Sitemap generation is done by the Jekyll Sitemap plugin. So any questions or unexpected results when using it should be filed on that repo.

That said I think this is an easy fix on your part. There are some small differences in the jekyll serve and jekyll build commands. The big one obviously is serve fires up a server.

It also overrides url: in your _config.yml to localhost:4000, which is why you're seeing it in the sitemap.xml file it generates.

If you run bundle exec jekyll build instead that will build your site and use whatever domain is currently assigned to url in your _config.yml. If you're hosting on GitHub Pages I'm pretty it sets it for you automatically in the case you omitted it.

Oops. Just understood. That serving caused to render it in localhost. Excuse the beginner question.
Thanks anway! :)

And Man! Thanks for such a nice theme.

Hey @mmistakes ,

I have actually exactly this problem. I want to "fire up" my server on my hosting-server and the url is overwritten by localhost.

So I just got it working with this workaround:

  1. Build site
  2. Fire up the server with "--skip-initial-build"

And if I want to update the page in the future I just need to build it again.

It works, but seems a bit odd to me. Well I'm not a web-dev, but shouldn't it work with just firing up the server?

@bastoGrande That's is a question for core Jekyll and has nothing to do with the theme.

As stated above they built in some logic to override site.url to localhost:4000 when starting a development server, since that's what you likely want locally when testing. When you run jekyll build it doesn't do that and will uses whatever values you've assigned for url in your _config.yml.

If you want to disable that behavior when running a local jekyll serve you need to use environment variables. See the official docs, but essentially you run JEKYLL_ENV=prod jekyll serve to force production instead of the default development.

Was this page helpful?
0 / 5 - 0 ratings