Support Jinja macros, make media refs SHA-aware