Fix #123: pass shared context to templates and use digest