Handle new-style memberships in templates

When an organization is related to an organization or a person related
to a person using the member property of a relationship this ensures
that relationship is displayed correctly.