Sitemap.xml Generator is a Jekyll plugin that generates a sitemap.xml file by traversing all of the available posts and pages.
- Copy file into your _plugins folder within your Jekyll project or add as submodule.
- Ensure url is set in your config file (for example
url: http://www.domain.com
) - In your config file, change
sitemap: filename:
if you want your sitemap to be called something other than "sitemap.xml". - Change the
sitemap: exclude:
list to exclude any pages that you don't want in the sitemap. - Change the
sitemap: include_posts:
list to include any pages that are looping through your posts (e.g. "/index.html", "/notebook/index.md", etc.). This will ensure that right after you make a new post, the last modified date will be updated to reflect the new post. - Run Jekyll:
jekyll build
to re-generate your site. - A
sitemap.xml
should be included in your _site folder. - Remember to submit the sitemap URL to Google and add a robots.txt
Configuration defaults:
sitemap:
filename: "/sitemap.xml"
exclude:
- "/atom.xml"
- "/feed.xml"
- "/feed/index.xml"
include_posts:
- "/index.html"
change_frequency_name: "change_frequency"
priority_name: "priority"
lastmod_name: "lastmod"
frequency:
posts: "monthly"
pages: "yearly"
index: "monthly"
priority:
posts: 0.5
pages: 0.3
index: 0.4
If you want to include the optional <changefreq>
and <priority>
attributes, simply include custom variables in the YAML Front Matter of those files. The names of these custom variables are defined in the config file as sitemap: change_frequency_name:
and sitemap: priority_name:
. Alternatively, you can set them in the configuration under sitemap: frequency:
and sitemap: priority:
as seen in the example above.
- URLs that match include_posts are considered indexes, for frequency and priority.
Author: Pedro Monjo (https://www.pedromonjo.com)
Forked from Jekyll Plugin: Sitemap.xml Generator by Michael Levin (http://www.kinnetica.com)
Distributed Under A Creative Commons License