Skip to content
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

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? #918

Closed
3 of 5 tasks
themoralpanda opened this issue Mar 23, 2017 · 4 comments

Comments

@themoralpanda
Copy link

  • This is a question about using the theme.
  • This is a feature request.
  • I have updated all gems with bundle update.
  • 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.

@mmistakes
Copy link
Owner

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.

@themoralpanda
Copy link
Author

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.

@ghost
Copy link

ghost commented May 19, 2017

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?

@mmistakes
Copy link
Owner

@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.

yesterz pushed a commit to yesterz/yesterz.github.io-test that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants