# replaceRE on render hook

**URL:** <https://discourse.gohugo.io/t/replacere-on-render-hook/35265>\
**Category:** support\
**Created:** [October 21, 2021, 4:31pm UTC](https://discourse.gohugo.io/t/replacere-on-render-hook/35265 "2021-10-21T16:31:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [October 21, 2021, 4:31pm UTC](https://discourse.gohugo.io/t/replacere-on-render-hook/35265/1 "2021-10-21T16:31:59Z")

</div>

I’m trying render hooks to fix markdown links that end in .md and should end in .html but I am getting a syntax error that I can’t figure out:

```auto
<a href="{{ .Destination | replaceRE '\.md$' '\.html' | safeURL }}"
{{ with .Title}} title="{{ . }}" {{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener" {{ end }}>{{ .Text | safeHTML }}</a>

```

Am I missing something here? Or maybe there is a better way to achieve the same result ?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 21, 2021, 4:38pm UTC](https://discourse.gohugo.io/t/replacere-on-render-hook/35265/2 "2021-10-21T16:38:11Z")

</div>

Use backticks instead of single quotes.

[https://golang.org/ref/spec#Rune\_literals](https://golang.org/ref/spec#Rune_literals)  
[https://golang.org/ref/spec#String\_literals](https://golang.org/ref/spec#String_literals)

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 23, 2021, 4:38pm UTC](https://discourse.gohugo.io/t/replacere-on-render-hook/35265/3 "2021-10-23T16:38:34Z")

</div>

Closed on October 23, 2021, 4:38pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
