Skip to content

Instantly share code, notes, and snippets.

@thecocktail
Created September 4, 2008 21:58
Show Gist options
  • Save thecocktail/8887 to your computer and use it in GitHub Desktop.
Save thecocktail/8887 to your computer and use it in GitHub Desktop.
Nanoc plugin to solve usual problems working with nanoc projects
# This function helps to build a relative path from the page to the output root.
#
# Usage: <img src="<%= page_depth @page.path %>images/hardon.png" alt="wadus" />
def page_depth path
depth = ""
(path.split("/").size-1).times do
depth = depth + "../"
end
depth
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment