adds dynamic viewing on detail and index page