Skip to content


Document how to make relative work with partials #60

merged 1 commit into from

2 participants


No description provided.


This partial trick is used by, and maybe others.

@LightGuard LightGuard merged commit 1d7d848 into awestruct:master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2014
  1. @ge0ffrey


    ge0ffrey committed
Showing with 16 additions and 0 deletions.
  1. +16 −0 extensions/relative/
16 extensions/relative/
@@ -28,3 +28,19 @@ And for `/one/two/three.html` this will result in:
Of course, it works on all kinds of URL usages:
%link{:rel => "shortcut icon", :href => relative("/favicon.ico")}
+To make it work properly in partials, you need to pass along the outputPage to every partial and to the relative function:
+The outputPage `blogAggregation.html.haml` passes itself:
+ = partial('blogPostBody.html.haml', :outputPage => page, ...)
+to the partial `blogPostBody.html.haml`, which passes that outputPage:
+ = partial('userBadge.html.haml', :outputPage => page.outputPage, ...)
+to the partial `userBadge.html.haml`, which passes it to the relative call:
+ %img{:src => relative("/common/twitterLogo.png", page.outputPage)}
Something went wrong with that request. Please try again.