sitemap.xml Sitemaps in Jekyll

Home, Bangkok, Thailand, 2019-05-31 23:23 +0700

#webdev

Another small thing I wanted to add to this revamped website built on Jekyll is sitemaps.org sitemap.xml support. I did this 13 years ago on the Pebble version of my blog by writing a plugin for Pebble in Java. Fortunately Jekyll has an official plugin already which is found at: https://github.com/jekyll/jekyll-sitemap.

The instructions are very straightforward, however I hit this error when I ran the site after adding the Gemfile entry and the registering the plugin:

Could not find gem 'jekyll-sitemap x64-mingw32' in any of the gem sources listed in your Gemfile

To fix this run bundler install before running serve - if you’re a Ruby guy (I’m not) you would know this (I didn’t):

bundler install

λ bundler install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using public_suffix 3.0.3

...

Using jekyll-seo-tag 2.5.0
Fetching jekyll-sitemap 1.3.1
Installing jekyll-sitemap 1.3.1
Bundle complete! 7 Gemfile dependencies, 34 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Now you can run the usual command to serve the site in dev-mode:

bundler exec jekyll serve

The sitemap.xml will show up in your generated site. You can now register this with the search engines.

To register the sitemap.xml with Google so that their crawler will visit it:

  • Login to https://search.google.com/search-console
  • Add your site as a property - you will need to verify ownership by uploading the file that Google generates
  • Click the hamburger button at the top-left corner to show the nav and select Sitemaps
  • Add the sitemap.xml path

Google still remembered my sitemap from the last time I registered it - in 2013! But I re-registered it anyway just to be sure.

Registering with Bing is similar: