One option is to use a shortcode. So instead of this unpreferable way that you mentioned:

You could do:
{{< img "alt" "image/test.jpg" >}}
And the shortcode definition (let’s say it’s named img.html) could be like:
<img src="/gg/{{ .Get 1 }}" alt="{{ .Get 0 }}">
Or:
<img src="{{ .Get 1 | absURL }}" alt="{{ .Get 0 }}">