It's easiest to keep everything in one templating system and language. (Note: I said easiest, not most robust or ideal.)
Options:
1. Isomorphic code. This requires either NodeJS or compile-to-JS tooling.
2. Client-side-only: bad for SEO and usability.
3. Server-side-only: You either write several lives of boilerplate every time line your example, or use intercooler and write a single-liner.