I’m creating my personal blog (davioooh.com) using Jekyll and hosting it on GitHub pages.
But I recently discovered a strange thing…
When pushed/deployed to my repository, the blog sitemap.xml
includes two extra urls:
<url>
<loc>
http://davioooh.com/assets/javascript/anchor-js/docs/grunticon/preview.html
</loc>
<lastmod>2017-08-11T16:40:49+00:00</lastmod>
</url>
<url>
<loc>
http://davioooh.com/assets/javascript/anchor-js/docs/index.html
</loc>
<lastmod>2017-08-11T16:40:49+00:00</lastmod>
</url>
I can’t understand why… I’m not using any anchor-js gem or plug-in…
The only gems declared in my _config.yml
and Gemfile
are:
gems:
- jekyll-feed
- jekyll-seo-tag
- jekyll-paginate
- jekyll-sitemap
So why I’m getthing that urls?
NOTE: the sitemap is correct when I test the site locally on my dev machine.
NOTE: I’m using a custom theme (regular theme, not gem-based). No theme declared in my _config.yml
. Here you find my blog repository: https://github.com/davioooh/davioooh.github.io
UPDATE Tried to replace jekyll
gem with github-pages
in my Gemfile
as suggested by marcanuy. It works locally, but after a new push sitemap still includes the extra urls…
UPDATE Found GitHub pages reference listing default params for Jekyll websites. Default theme is, as expected, jekyll-theme-primer
. How can I override this setting if I’m not using gem-based theme?
4
Answers
It seems that updating to github-pages v157 the sitemap is generated correctly.
The new version of gh-pages supports the last version of
jekyll-theme-primer
(v0.5.2).This solves my issue.
It comes from your theme:
jekyll-theme-primer
Primer is what powers GitHub’s frontend. If you’re not using this theme explicitly, it probably comes from GitHub Pages’ own usage of the Primer framework
Why it works fine locally?
Because you are not using the same dependencies Github Pages uses. To replicate the environment used by Github, you need to use the gem:
github-pages
.Why sitemap.xml includes two extra urls?
As @ashmaroli said, these files comes from
jekyll-theme-primer
which is used by Github Pages, if you are using your own theme files, then just make sure there are notheme:
key in your_config.yml
and runbundle update
. Using the rightgithub-pages
gem will fix it and those files won’t be included in your final site.1. Apparently, the jekyll-theme-primer (which usually comes with
group: :jekyll_plugins
in yourGemfile
) is to blame. I.e.theme: minima
avoids the creation ofanchor-js
(but you probably want to run your own theme, and not having minima hang around…)2. A verified simple fix (giving a warning upon build) is to write
in your
_config.yml
3. The issue is a known issue and has been fixed 3 days before me writing this. Might day some days (or weeks) until it gets shipped though. If you read this some time from now, probably all you need to is update your gems.