def get_hashtagged_posts(hashtag, page=1, per_page=None):
    """Returns all posts with `hashtag` in date order."""
    if per_page is None:
        per_page = app.config.get('FEED_ITEMS_PER_PAGE')

    total = m.db.posts.find({
        'hashtags.hashtag': hashtag,
        'reply_to': {'$exists': False}}).count()
    cursor = m.db.posts.find({
        'hashtags.hashtag': hashtag,
        'reply_to': {'$exists': False}
    }).sort('created', -1).skip((page - 1) * per_page).limit(per_page)

    posts = []
    for post in cursor:
        user = m.db.users.find_one(
            {'_id': post.get('user_id')},
            {'avatar': True})

        if post is not None:  # pragma: no branch
            post['user_avatar'] = user.get('avatar')
            posts.append(post)

    return Pagination(posts, total, page, per_page)