git-read

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 lib directory.

An even easier way is to put your helpers in the helpers directory and name them after their module (i.e., CustomHelpers lives in helpers/custom_helpers.rb). Then, Middleman will automatically load them and register them as helpers.