relative_path_to and non-routed representations

46 views
Skip to first unread message

Sean Davis

unread,
Mar 22, 2013, 1:31:42 PM3/22/13
to na...@googlegroups.com
I am trying to use the relative_path_to() helper function from a blog entry.  I create a summary representation that is not routed (returns nil) for inclusion in a blog index page.  I have in the blog entry:

<%= relative_path_to('/assets/plot.png') %>

However, I get this error:

RuntimeError at /blog/testing-for-non-differentially-expressed-genes/

Cannot get the relative path to /assets/Rplot001.png because the current item representation, <Nanoc::ItemRep name="summary" binary=false raw_path="" item.identifier="/blog/testing-for-non-differentially-expressed-genes/">, is not outputted (its routing rule returns nil)

It makes perfect sense to me, but is there a way to use the relative_path_to() in this situation?

Thanks,
Sean

Denis Defreyne

unread,
Mar 23, 2013, 3:36:02 PM3/23/13
to na...@googlegroups.com
Hi Sean,

If a routing rule returns nil, that means that the item (e.g. your plot.png) will simply not be written to disk into the output directory. If you want to link to that file, it will need to be written, which means that the routing rule needs to return something non-nil.

Denis
> --
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "nanoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Eric Sunshine

unread,
Mar 23, 2013, 8:49:31 PM3/23/13
to na...@googlegroups.com
I think that Sean actually means that his blog entry is routed to nil,
not the image file. The blog entry wants to reference the (routed)
image with a relative path but can't.

-- ES

justin

unread,
Mar 23, 2013, 9:16:39 PM3/23/13
to na...@googlegroups.com
Use a non-relative path here then relativize_paths after?

Sean Davis

unread,
Mar 25, 2013, 7:29:58 AM3/25/13
to na...@googlegroups.com
On Sat, Mar 23, 2013 at 9:16 PM, justin <jus...@justinhileman.info> wrote:
Use a non-relative path here then relativize_paths after?


Thanks, Justin.  What you suggest will work just fine.
 

On Sat, Mar 23, 2013 at 5:49 PM, Eric Sunshine <suns...@sunshineco.com> wrote:
I think that Sean actually means that his blog entry is routed to nil,
not the image file. The blog entry wants to reference the (routed)
image with a relative path but can't.

Yes, this was the problem I was trying to solve.

Sean
Reply all
Reply to author
Forward
0 new messages