Skip to content
master
Go to file
Code
This branch is 4 commits ahead, 12 commits behind kinnetica:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

README.md

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:

  1. Copy the sitemap_generator.rb file into your _plugins folder within your Jekyll project.
  2. Ensure url is set in your config file (for example url: http://danielgroves.net)
  3. In your config file, change sitemap: file: if you want your sitemap to be called something other than sitemap.xml.
  4. Change the sitemap: exclude: list to exclude any pages that you don't want in the sitemap.
  5. 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.
  6. Run Jekyll: jekyll to re-generate your site.
  7. A sitemap.xml should be included in your _site folder.

Configuration defaults:

sitemap:
    file: "/sitemap.xml"
    exclude:
        - "/atom.xml"
        - "/feed.xml"
        - "/feed/index.xml"
    include_posts:
        - "/index.html"
    change_frequency_name: "change_frequency"
    priority_name: "priority"

Customizations:

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:.

Last Modified and Generators:

Page and Post subclasses can implement their own last_modified methods to provide an intelligent value to this generator. Rather than changing and coupling the other generators to this generator, we can add the last_modified method with meta programming. Two examples are provided:

  1. generate_categories_last_modified.rb adds a last_modified method to the CategoryIndex page generated by the Jekyll category page generator (http://recursive-design.com/projects/jekyll-plugins/) that is calculated by the latest last_modified date of all posts in the category.
  2. temporal_archive_generator_last_modified.rb adds a last_modified method to the MonthlyIndexPage pages and YearlyIndexPages generated by the Yearly and Monthly Archive Generator for Jekyll (https://github.com/edelabar/jekyll-temporal-archive-generator) that is calculated by the latest last_modified date of all posts in the given time frame.

This generator runs at :lowest priority in Jekyll, as long as all other generators are higher than that their results will be included in the sitemap.

Notes:

  1. 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, ...

Author: Michael Levin (http://www.kinnetica.com) Configuration Update: Daniel Groves (http://danielgroves.net)

Distributed Under A Creative Commons License

About

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.