@register.simple_tag(takes_context=True)
def pageurl(context, page):
 return page.relative_url(context[u'request'].site)

@ register . simple_tag ( takes_context = True ) def pageurl ( context , page ) : return page . relative_url ( context [ u'request' ] . site )
outputs a pages url as relative if its within the same site as the current page .