Added dynamic links to the gallery pages

Shortned code so that it will show one view page template for every
gallery