Module: Roda::RodaPlugins::RelativePath

Defined in:


The relative_path plugin adds a relative_path method that accepts an absolute path and returns a path relative to the current request by adding an appropriate prefix:

plugin :relative_path
route do |r|

# GET /

# GET /bar

# GET /bar/

# GET /bar/baz/quux

It also offers a relative_prefix method that returns a string that can be prepended to an absolute path. This can be more efficient if you need to convert multiple paths.

This plugin is mostly designed for applications using Roda as a static site generator, where the generated site can be hosted at any subpath.

Defined Under Namespace

Modules: InstanceMethods