Jekyll Plugin: Sitemap.xml Generator
Sitemap.xml Generator is a Jekyll plugin that generates a sitemap.xml file by traversing all of the available posts and pages.
How To Use:
- Copy file into your _plugins folder within your Jekyll project.
- Change MY_URL to reflect your domain name.
- Change SITEMAP_FILE_NAME if you want your sitemap to be called something other than sitemap.xml.
- Change the PAGES_INCLUDE_POSTS list to include any pages that are looping through your posts (e.g. "index.html", "archive.html", etc.). This will ensure that right after you make a new post, the last modified date of those pages will be updated to reflect the new post.
- Run Jekyll: jekyll --server to regenerate your site.
- A sitemap.xml should be included in your _site folder.
- If there are any files you don't want included in the sitemap, add the names of the files to the EXCLUDED_FILES list.
- 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 source file in the CHANGE_FREQUENCY_CUSTOM_VARIABLE_NAME and PRIORITY_CUSTOM_VARIABLE_NAME constants.
- The last modified date is determined by the latest date of the following: system modified date of the page or post, system modified date of included layout, system modified date of included layout within that layout, ...
- This project is available on GitHub here.