Ofek Gila
Ofek Gila

Reputation: 703

Github's jekyll sitemap generator giving wrong urls for spaces

One of the urls for my page is:

http://blog.theofekfoundation.org/general%20computer%20programming/2015/12/30/2d-array-copy-speeds.html (note the %20s)

While the jekyll sitemap entry is:

<loc>
    http://blog.theofekfoundation.org/general%2520computer%2520programming/2015/12/30/2d-array-copy-speeds.html
</loc> # Note the %2520s

I added the sitemap using github's sitemap gem:

gems:
 - jekyll-sitemap

in my _config.yml.

Any idea what's going wrong or how to fix it?

Upvotes: 1

Views: 273

Answers (1)

C. Augusto Proiete
C. Augusto Proiete

Reputation: 27878

At the moment, jekyll-sitemap always encode the URLs and is not smart enough to detect that the URL already contains encoded text, which is causing it to encode the % character (hence the %25).

You can open an issue on the jekyll-sitemap repository, and see if there are any plans to improve this story.

However, if that is an option, I would recommend you to not use spaces, and instead use a dash -, which is more user-friendly and easier to read... With the added benefit that it doesn't break the sitemap.

Also, get rid of the .html at the end.

e.g. http://blog.theofekfoundation.org/general-computer-programming/2015/12/30/2d-array-copy-speeds/

Upvotes: 3

Related Questions