Is it possible to retrieve the current path of a page in a middleman file? For instance, if I have a layout file layout.erb with something like the following:
<%= page.path %>
<%= yield %>
and a test file index.html:
Testing
then when Middleman rendered the page I would get something like:
/index.html
Testing
Middleman also provides the
current_pagevariable.current_page.pathis the source path of this resource (relative to the source directory, without template extensions) andcurrent_page.urlis the path without the directory index (sofoo/index.htmlbecomes justfoo).Details from Middleman’s
Middleman::Sitemap::Resourcerubydoc.http://rubydoc.info/github/middleman/middleman/Middleman/Sitemap/Resource