# .RenderString and render hooks

**URL:** <https://discourse.gohugo.io/t/renderstring-and-render-hooks/34677>\
**Category:** support\
**Created:** [September 11, 2021, 8:27pm UTC](https://discourse.gohugo.io/t/renderstring-and-render-hooks/34677 "2021-09-11T20:27:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![codingforfun](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@codingforfun](https://discourse.gohugo.io/u/codingforfun)\
**Post date:** [September 11, 2021, 8:27pm UTC](https://discourse.gohugo.io/t/renderstring-and-render-hooks/34677/1 "2021-09-11T20:27:26Z")

</div>

I’m looking to use .RenderString as I want to make use of render hooks. Markdownify does everything I need except when I want to handle images its not ideal and replaceRE is very useful but only up to a certain point.

I’m not certain but from the documentation I don’t believe I need to do anything additional for it to recognise the render hooks. I don’t need different options from the page.

Any ideas/thoughts will be much appreciated.

```auto
{{ .copy | markdownify }}
{{ .copy | $.Page.RenderString }}

```

Both are producing the exact same output despite the fact that I have a render-image.html file (definitely working tested via .Content) which should convert the image file reference to a `<img>` tag.

```auto
<h2>Sample Title Blah Blah</h2>
![](/uploads/sample-image.jpg)

```

---

<div class="post-metadata">

**Author:** ![codingforfun](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@codingforfun](https://discourse.gohugo.io/u/codingforfun)\
**Post date:** [September 12, 2021, 6:35am UTC](https://discourse.gohugo.io/t/renderstring-and-render-hooks/34677/2 "2021-09-12T06:35:52Z")

</div>

Exact issue has been discussed here:  
[https://discourse.gohugo.io/t/render-hooks-not-hooking/23605/8](https://discourse.gohugo.io/t/render-hooks-not-hooking/23605/8)

```auto
{{ $c := .Content }}
{{ .copy | $.Page.RenderString }}

```

Unfortunately this approach of making sure `.Content` is present on the page doesn’t work for me.

When I download ghandiShepard’s repo I can see the fix working so I will now need to figure out why it works on that site and not mine.

**Edit** : If I build a quick shell of a new site this works for me but I have no idea why its not working in my current project.

---

<div class="post-metadata">

**Author:** ![codingforfun](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@codingforfun](https://discourse.gohugo.io/u/codingforfun)\
**Post date:** [September 12, 2021, 8:44am UTC](https://discourse.gohugo.io/t/renderstring-and-render-hooks/34677/3 "2021-09-12T08:44:56Z")

</div>

Sorted

I’ll explain in case anyone else encounters this issue.  
It turns out that if there is no line break between the `![](/uploads/sample-image.jpg)` and any HTML in the string it prevents the render hooks.

Avoid something like this `<div class="img-wrapper">![](/uploads/sample-image.jpg)</div>`

Massive relief to figure this out as `.RenderString` is a game changer for me.

Kudos to the [gandhiShepard](https://discourse.gohugo.io/u/gandhiShepard) and [onedrawingperday](https://discourse.gohugo.io/u/onedrawingperday)
