def render_title_tag(context, is_og=False):
    """
    Returns the title as string or a complete open graph meta tag.
    """
    request = context['request']
    content = ''

    # Try to get the title from the context object (e.g. DetailViews).
    if context.get('object'):
        try:
            content = context['object'].get_meta_title()
        except AttributeError:
            pass
    elif context.get('meta_tagger'):
        content = context['meta_tagger'].get('title')

    if not content:
        # Try to get the title from the cms page.
        try:
            content = request.current_page.get_page_title()  # Try the `page_title` before the `title of the CMS page.
            if not content:
                content = request.current_page.get_title()
        except (AttributeError, NoReverseMatch):
            pass

    if not is_og:
        return content
    else:
        return mark_safe('<meta property="og:title" content="{content}">'.format(content=content))
Returns the title as string or a complete open graph meta tag.