diff --git a/middleman-core/lib/middleman-core/core_extensions/assets.rb b/middleman-core/lib/middleman-core/core_extensions/assets.rb index 8db7e1ba..92cc4859 100644 --- a/middleman-core/lib/middleman-core/core_extensions/assets.rb +++ b/middleman-core/lib/middleman-core/core_extensions/assets.rb @@ -24,7 +24,14 @@ module Middleman::CoreExtensions::Assets # @return [String] The fully qualified asset url def asset_url(path, prefix="") # Don't touch assets which already have a full path - path.include?("://") ? path : File.join(http_prefix, prefix, path) + if path.include?("//") + path + else # rewrite paths to use their destination path + path = File.join(prefix, path) + path = sitemap.page(path).destination_path if sitemap.exists?(path) + + File.join(http_prefix, path) + end end end -end \ No newline at end of file +end