use Javascript snippets for code in HTML templates
consolidate archive post fetching code