def your_tips_on_homepage(context):
    """
    A template tag for the Tip of the Day on the homepage.
    Note that:
    * If there is an active featured_in_homepage tip it will take precedence.
    * If there is no featured tip a popular tip will be displayed.
    * If there is no featured tip and no popular tip,
        the most recent tip will be displayed.
    :param context: takes context
    """
    context = copy(context)
    site_main = context['request'].site.root_page
    if get_your_tip(context):
        tip_on_homepage = (YourTipsArticlePage.objects
                           .descendant_of(site_main)
                           .filter(featured_in_homepage=True)
                           .order_by('-featured_in_homepage_start_date')
                           .first())

        if not tip_on_homepage:
            tip_on_homepage = (YourTipsArticlePage.objects
                               .descendant_of(site_main)
                               .order_by('-total_upvotes')
                               .first())

        if not tip_on_homepage:
            tip_on_homepage = (YourTipsArticlePage.objects
                               .descendant_of(site_main)
                               .order_by('-latest_revision_created_at')
                               .first())

        context.update({
            'article_tip': tip_on_homepage,
            'your_tip_page_slug': get_your_tip(context).slug
        })
    return context