Defining a template and reusing it later?

I’m pretty new to HA and to yaml, so this may be a really dumb question. I did do a fair bit of digging before asking though :slight_smile:

I’ve got a reasonably complex value_template I use for all my mqtt sensors. Is it possible to store it in a variable/macro/something and re-use it rather than having to have a copy of it on every sensor?

Cheers

David