lib/nanoc/helpers/xml_sitemap.rb in nanoc-4.2.4 vs lib/nanoc/helpers/xml_sitemap.rb in nanoc-4.3.0
- old
+ new
@@ -1,41 +1,11 @@
module Nanoc::Helpers
- # Contains functionality for building XML sitemaps that will be crawled by
- # search engines. See the [Sitemaps protocol site](http://www.sitemaps.org)
- # for details.
+ # @see http://nanoc.ws/doc/reference/helpers/#xmlsitemap
module XMLSitemap
- # Builds an XML sitemap and returns it.
+ # @option params [Array] :items
+ # @option params [Proc] :rep_select
#
- # The following attributes can optionally be set on items to change the
- # behaviour of the sitemap:
- #
- # * `changefreq` — The estimated change frequency as defined by the
- # Sitemaps protocol
- #
- # * `priority` — The item's priority, ranging from 0.0 to 1.0, as defined
- # by the Sitemaps protocol
- #
- # The sitemap will also include dates on which the items were updated.
- # These are generated automatically; the way this happens depends on the
- # used data source (the filesystem data source checks the file mtimes, for
- # instance).
- #
- # The site configuration will need to have the following attributes:
- #
- # * `base_url` — The URL to the site, without trailing slash. For example,
- # if the site is at "http://example.com/", the `base_url` would be
- # "http://example.com".
- #
- # @example Excluding binary items from the sitemap
- #
- # <%= xml_sitemap :items => @items.reject{ |i| i[:is_hidden] || i.binary? } %>
- #
- # @option params [Array] :items A list of items to include in the sitemap
- #
- # @option params [Proc] :rep_select A proc to filter reps through. If the
- # proc returns true, the rep will be included; otherwise, it will not.
- #
- # @return [String] The XML sitemap
+ # @return [String]
def xml_sitemap(params = {})
require 'builder'
# Extract parameters
items = params.fetch(:items) { @items.reject { |i| i[:is_hidden] } }