[WIP - do not merge] Templating messages

I'm reworking the search templates.
It's a branch of #1427 so there are some unnecessary bits, I'll remove them once the other PR is merged.

I opened the PR because templates are not my favourite piece of stuff to work on, so feel free to beat me if you see something stupid. :hammer: