diff --git a/middleman-more/features/helpers_link_to.feature b/middleman-more/features/helpers_link_to.feature
index 1607cc24..e445f7f0 100644
--- a/middleman-more/features/helpers_link_to.feature
+++ b/middleman-more/features/helpers_link_to.feature
@@ -21,6 +21,40 @@ Feature: link_to helper
Then I should see 'absolute: Needs Index'
Then I should see 'relative: Relative'
+ Scenario: link_to relative works with strip_index_file
+ Given a fixture app "indexable-app"
+ And a file named "config.rb" with:
+ """
+ set :relative_links, true
+ set :strip_index_file, true
+ helpers do
+ def menu_items(path='link_to.html')
+ sitemap.find_resource_by_destination_path(path).children
+ end
+ end
+ """
+ And a file named "source/link_to.html.erb" with:
+ """
+ <% menu_items.each do |item| %>
+ <%= link_to(item.metadata[:page]['title'], item.url) %>
+ <%= link_to(item.metadata[:page]['title'], item) %>
+ <% end %>
+ """
+ And a file named "source/link_to/sub.html.erb" with:
+ """
+ <% menu_items.each do |item| %>
+ <%= link_to(item.metadata[:page]['title'], item.url) %>
+ <%= link_to(item.metadata[:page]['title'], item) %>
+ <% end %>
+ """
+ And the Server is running at "indexable-app"
+ When I go to "/link_to.html"
+ Then I should see '"link_to/sub.html"'
+ Then I should not see "/link_to/sub.html"
+ When I go to "/link_to/sub.html"
+ Then I should see '"sub.html"'
+ Then I should not see "/link_to/sub.html"
+
Scenario: link_to produces relative links when :relative_links is set to true
Given a fixture app "indexable-app"
And a file named "config.rb" with:
diff --git a/middleman-more/lib/middleman-more/core_extensions/default_helpers.rb b/middleman-more/lib/middleman-more/core_extensions/default_helpers.rb
index c2028407..78c4b50e 100644
--- a/middleman-more/lib/middleman-more/core_extensions/default_helpers.rb
+++ b/middleman-more/lib/middleman-more/core_extensions/default_helpers.rb
@@ -129,8 +129,10 @@ module Middleman
# Handle Resources, which define their own url method
if url.respond_to? :url
- args[url_arg_index] = url.url
- elsif url.include? '://'
+ url = args[url_arg_index] = url.url
+ end
+
+ if url.include? '://'
raise "Can't use the relative option with an external URL" if relative
elsif current_resource
# Handle relative urls