added search bar for blog posts and made code more dry