From 071acadb93d5cc2fdd814bf8d37eafd0f0706465 Mon Sep 17 00:00:00 2001 From: Eric Skogen Date: Mon, 16 Jan 2012 16:29:02 -0600 Subject: [PATCH] clarify the documentation regarding a page's "eponymous" directory --- middleman-core/lib/middleman-core/sitemap/page.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/middleman-core/lib/middleman-core/sitemap/page.rb b/middleman-core/lib/middleman-core/sitemap/page.rb index 52927a7a..8a8fab81 100644 --- a/middleman-core/lib/middleman-core/sitemap/page.rb +++ b/middleman-core/lib/middleman-core/sitemap/page.rb @@ -159,19 +159,21 @@ module Middleman::Sitemap end end - # Whether this page is a directory index + # Whether this page either a directory index, or has the same name as an existing directory in the source # @return [Boolean] def directory_index? path.include?(app.index_file) || path =~ /\/$/ || eponymous_directory? end - - # Whether this page is a eponymous_directory + + # Whether the page has the same name as a directory in the source + # (e.g., if the page is named 'gallery.html' and a path exists named 'gallery/', this would return true) # @return [Boolean] def eponymous_directory? !!Dir.exists?(File.join(app.source_dir, eponymous_directory_path)) end - # The path for the eponymous_directory of this page + # The path for this page if it were a directory, and not a file + # (e.g., for 'gallery.html' this would return 'gallery/') # @return [String] def eponymous_directory_path path.sub('.html', '/').sub(/\/$/, "") + "/"