Modularised code

Wrote methods to replace repeated code

method for creating the index template render, gettting latest posts and
latest tags