Make judicious use of layouts.

- [x] Extract duplicate code into layout
- [x] Use layout
- [x] Refactor JS on contact page