Merge pull request #300 from bhollis/url

A url helper that strips directory indexes
This commit is contained in:
Thomas Reynolds 2012-03-05 08:36:14 -08:00
commit 38d1059be2

View file

@ -182,6 +182,13 @@ module Middleman::Sitemap
# TODO: Seems like .html shouldn't be hardcoded here # TODO: Seems like .html shouldn't be hardcoded here
end end
# A path without the directory index - so foo/index.html becomes
# just foo. Best for linking.
# @return [String]
def url
'/' + destination_path.sub(/#{Regexp.escape(app.index_file)}$/, '')
end
# Get the relative path from the source # Get the relative path from the source
# @return [String] # @return [String]
def relative_path def relative_path