Extract UrlHelpers
This commit extracts commonly hard-coded path values into a singular
location, which is shared in the implementation and the test suite
through the newly declared UrlHelpers module.
Middleman support extending the rendering context by passing modules to
the helpers method:
In addition to the helpers provided by Middleman out of the box, you can also add your own helper methods and classes that will be accessible within any controller or view automatically.
Alternatively, you can create external Ruby modules which contain helpers and include them. You can put files in the
libdirectory.An even easier way is to put your helpers in the
helpersdirectory and name them after their module (i.e.,CustomHelperslives inhelpers/custom_helpers.rb). Then, Middleman will automatically load them and register them as helpers.