4

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?

davioooh
  • 20,249
  • 33
  • 132
  • 224
  • This is quite annoying, I can see that you've done the same thing and added `Disallow: /assets/javascript/*` to the sitemap to prevent search engines from indexing these pages – Sam Denty Aug 22 '17 at 09:48
  • @SamDenty yes, I'm still looking for a solution... Meanwhile I applied this workaround... – davioooh Aug 22 '17 at 10:08

4 Answers4

1

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

ashmaroli
  • 4,499
  • 2
  • 10
  • 24
1

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 no theme: key in your _config.yml and run bundle update. Using the right github-pages gem will fix it and those files won't be included in your final site.

marcanuy
  • 19,934
  • 8
  • 56
  • 109
  • This doesn't seem to work for me. I have no "theme" in my _config.yml and I replaced jekyll gem with github-pages, but after a new push sitemap still includes the extra url... what am I doing wrong? This is my site repository: https://github.com/davioooh/davioooh.github.io – davioooh Aug 14 '17 at 19:53
  • I can't replicate the issue, it works fine locally and in http://davioooh.com/sitemap.xml they don't appear. – marcanuy Aug 14 '17 at 19:56
  • „Using the right github-pages gem will fix it and those files won't be included in your final site.“ – so how do I do that? – Frank Nocke Apr 13 '18 at 07:05
  • 1
    @FrankNocke step 2.2 here: https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/ – marcanuy Apr 13 '18 at 12:58
0

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.

davioooh
  • 20,249
  • 33
  • 132
  • 224
0

1. Apparently, the jekyll-theme-primer (which usually comes with group: :jekyll_plugins in your Gemfile) is to blame. I.e. theme: minima avoids the creation of anchor-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

theme: false

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.

Frank Nocke
  • 7,493
  • 3
  • 58
  • 89