def METHOD_NAME(self):
    context_state = getMultiAdapter(
        (self.context, self.request), name=u'plone_context_state')
    canonical_object = context_state.canonical_object()
    if self.context != canonical_object:
        can_state = getMultiAdapter(
            (canonical_object, self.request), name=u'plone_context_state')
        url = can_state.view_url()
    else:
        url = context_state.view_url()
    return u'    <link rel="canonical" href="%s" />' % url