Returns the robots meta tag.

def render_robots_meta_tag(context):
    """
    Returns the robots meta tag.
    """
    request = context['request']
    robots_indexing = None
    robots_following = None

    # Prevent indexing any unwanted domains (e.g. staging).
    if context.request.get_host() in settings.META_TAGGER_ROBOTS_DOMAIN_WHITELIST:

        # Try to get the title from the context object (e.g. DetailViews).
        if context.get('object'):
            try:
                robots_indexing = context['object'].get_robots_indexing()
                robots_following = context['object'].get_robots_following()
            except AttributeError:
                pass
        elif context.get('meta_tagger'):
            robots_indexing = context['meta_tagger'].get('robots_indexing', robots_indexing)
            robots_following = context['meta_tagger'].get('robots_following', robots_following)

        # Try fetching the robots values of the cms page.
        if robots_indexing is None:
            try:
                robots_indexing = request.current_page.metatagpageextension.robots_indexing
            except (AttributeError, NoReverseMatch, MetaTagPageExtension.DoesNotExist):
                robots_indexing = True

        if robots_following is None:
            try:
                robots_following = request.current_page.metatagpageextension.robots_following
            except (AttributeError, NoReverseMatch, MetaTagPageExtension.DoesNotExist):
                robots_following = True

    return mark_safe('<meta name="robots" content="{robots_indexing}, {robots_following}">'.format(
        robots_indexing='index' if robots_indexing else 'noindex',
        robots_following='follow' if robots_following else 'nofollow'
    ))