module Middleman::Util

def full_path(path, app)

Returns:
  • (String) - Path with index file if necessary.

Parameters:
  • app (Middleman::Application) -- The requesting app.
  • path (String) -- Request path/
def full_path(path, app)
  resource = app.sitemap.find_resource_by_destination_path(path)
  unless resource
    # Try it with /index.html at the end
    indexed_path = File.join(path.sub(%r{/$}, ''), app.config[:index_file])
    resource = app.sitemap.find_resource_by_destination_path(indexed_path)
  end
  if resource
    '/' + resource.destination_path
  else
    '/' + normalize_path(path)
  end
end