#1932·middleman

Path prefix not added when using the directory_indexes extension and http_prefix

Author: murraysumCreated Jun 7, 2016Updated Oct 3, 2025
Labelsnotstale

Issue

When using the set :http_prefix, "/deploy-test" configuration and the directory_indexes extension the path is not always prefixed when using the link_to helper.

If you use the link_to helper with the source file then it correctly prefixes the "/deploy-test" path:

# Correctly generates /deploy-test/test/
<%= link_to "This works", "/test.html", target: "_blank" %> 

However, if you use the link_to helper with a directory path then it doesn't prefix the "/deploy-test" path:

# Incorrectly generates /test/ instead of /deploy-test/test/
<%= link_to "This should work but does not work", "/test/", target: "_blank" %>

Expected Behaviour

I would expect that when linking to the directory path when using the directory_indexes extension would prefix /deploy-test

Actual Behaviour

Linking to the directory path when using the directory_indexes extension does not prefix /deploy-test

Reproducibility

I searched the documentation/previous issues and couldn't find anything related to this. Apologises if there has been. I've created a sample app on Middleman v4.1.9 at https://github.com/murraysum/deploy-test and it is deployed to http://murraysum.github.io/deploy-test/

Please let me know if you need any help reproducing. Thanks