Hugo

Get variable inside replaceRe

Hi!

I use the partial headline-hash
{{ . | replaceRE "(<h2 id=\"([^\"]+)\".+)(</h2+>)" "${1}&nbsp;<a class=\"headline-hash\" href=\"#${2}\">#</a>${3}" | safeHTML }}

It’s called by
{{ partial "headline-hash" .Content }}

Can I use .Permalink inside replaceRE? The first article is completely visible on the start page and the headline-hash link is not correct. It shows /#example instead of /:slug/#example.

Cheers,
Benjamin