So Jekyll is awesome! Fast, lean, and mean. But what about sitemaps?
It’s actually really easy.
Via a Plugin
A very simple way is to use the jekyll-sitemap plugin. This plugin, when activated, will create a sitemap.xml file on your site that will contain a list of all of your pages.
Add this to your
_config.yaml file, making sure to add it to the following ‘gems’ and ‘whitelists’ areas if they are already specified:
gems: - jekyll-sitemap whitelist: - jekyll-sitemap
Depending on your setup, you may have to add it to you
And then either install the gem:
Now just build/serve, and you have your sitemap!
Via a file
The other option is to make a file called ‘sitemap.xml’ in your main jekyll folder, as in next to _post, _pages, and _includes.
All the file needs to contain is the following:
When you run
build, the liquid code above will generate a list of all the pages in your blog/site and serve/save it as ‘example.com/sitemap.xml’