Another (shorted) example (with relURL)
{{- $myFaviconVersion := default `a_random_value` $.Site.Params.favicon.version }}
{{- $myFaviconPath := default `/images/favicons` $.Site.Params.favicon.path }}
<link rel="shortcut icon" href='{{(printf `%s/%s?v=%s` $myFaviconPath `favicon.ico` $myFaviconVersion ) | relURL }}' />
<meta name="msapplication-TileImage" content='{{(printf `%s/%s?v=%s` $myFaviconPath `mstile-144x144.png` $myFaviconVersion ) | relURL }}' />
works with BaseURL (with subdir) and HUGO_CANONIFYURLS=false (the default)
<link rel="shortcut icon" href='/foo/bar/images/favicons/favicon.ico?v=a_random_value' />
<meta name="msapplication-TileImage" content='/foo/bar/images/favicons/mstile-144x144.png?v=a_random_value' />
but works not with HUGO_CANONIFYURLS=true
<link rel="shortcut icon" href='http://example.com/foo/bar/images/favicons/favicon.ico?v=a_random_value' />
<meta name="msapplication-TileImage" content='/images/favicons/mstile-144x144.png?v=a_random_value' />
possible fix:
<meta name="msapplication-TileImage" content='{{(printf `./%s/%s?v=%s` $myFaviconPath `mstile-144x144.png` $myFaviconVersion ) | absURL }}' />
(note the ./ in the printf)
So it is probably expected that I know which attributes hugo recognises as a “link” and are processed differently (e.g. href vs content)