To keep HTML out of the app/lib layer directly, maybe this function should generate the gravatar image tag itself? Then it can just be called from app/lib/navigation.