jekyll / jekyll-sitemap

Jekyll plugin to silently generate a sitemaps.org compliant sitemap for your Jekyll site
http://rubygems.org/gems/jekyll-sitemap
MIT License
949 stars 134 forks source link

get wrong url in sitemap.xml #215

Closed Rhysol closed 6 years ago

Rhysol commented 6 years ago

In my _config.yml , I set these: host: 0.0.0.0 port: 80 url: www.mywebsite.com The generated sitemap.xml do not use url, but use host(0.0.0.0). Am I config error? How can I fix this?

result: \<loc> http://0.0.0.0/2017/12/12/hello.html \<\/loc>

DirtyF commented 6 years ago

What are you trying to achieve? See https://jekyllrb.com/docs/usage/#override-default-development-settings

Rhysol commented 6 years ago

@DirtyF I want get \<loc> http://www.mywebsite.com/2017/12/12/hello.html \<\/loc> . I have follwed the instructions, but it didn't work. If the 'url' option did not work at all?

DirtyF commented 6 years ago

Did you run JEKYLL_ENV=production bundle exec jekyll build after reading our docs?

davidobrien1985 commented 6 years ago

@DirtyF I am having the same issue (#216 just missed this one here, sorry).

In my Dockerfile I have:

FROM jekyll/jekyll
COPY website /website
RUN gem install bundler
RUN chown -R jekyll /website
RUN JEKYLL_ENV=production bundle exec jekyll build --source /website
WORKDIR /website
CMD ["jekyll", "serve"]

This results in localhost:4000/sitemap.xml:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://0.0.0.0:4000/blog/</loc>
</url>
<url>
<loc>http://0.0.0.0:4000/contact/</loc>
</url>
<url>
<loc>http://0.0.0.0:4000/</loc>
</url>
<url>
<loc>http://0.0.0.0:4000/services/</loc>
</url>
<url>
<loc>http://0.0.0.0:4000/team/</loc>
</url>
<url>
<loc>http://0.0.0.0:4000/trainings/</loc>
</url>
</urlset>

Any ideas what's going wrong?

pathawks commented 6 years ago

I don't know anything about Docker, but the CMD ["jekyll", "serve"] line concerns me. Is this running jekyll serve? If so, that would be the problem, as it is running without JEKYLL_ENV=production

davidobrien1985 commented 6 years ago

That fixed it now. I'm setting JEKYLL_ENV globally now. Thanks.

Rhysol commented 6 years ago

@DirtyF @davidobrien1985 I also have fixed it . Just run JEKYLL_ENV=production bundle exec jekyll build did not work. It must set JEKYLL_ENV=production globally before run jekyll serve. Thanks a lot!

DirtyF commented 6 years ago

@Rhysol Feel free to improve the docs if this wasn't obvious. 😉