There are a number of additional parameters that automatically get passed to template toolkit. Here is the documentation:
https://metacpan.org/pod/Dancer::Template::Abstract
You will notice that one of them is params. So, within TT, you could build something like this:
<a href="/example?search=<% params.search %>&sort=<% params.sort %>&tag=<% params.tag %>"> ... </a>
Of course, if you wanted to get fancier, you could add them only conditionally. For example:
... <% IF params.sort %>&sort=<% params.sort %><%END%> ...