# Since 0.100.0 many "error calling RenderString"

**URL:** <https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878>\
**Category:** support\
**Created:** [May 31, 2022, 10:03pm UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878 "2022-05-31T22:03:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)\
**Post date:** [May 31, 2022, 10:03pm UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/1 "2022-05-31T22:03:53Z")

</div>

Before I open an issue on Github I would like to know if it’s an expected bahavior in current Hugo version.

I have a shortcode `layouts/shortcodes/ghsvs/callout.html`

```auto
{{- $css_class := .Get 0 | default "info" -}}

<div class="bd-callout bd-callout-{{ $css_class }}">
{{ .Inner | $.Page.RenderString }}
</div>

```

that I use in markdown with more or less (in this case 2) nested shortcodes like this:

```auto
{{< ghsvs/callout "success" >}}
{{< ghsvs/code >}}
{{ $img := resources.GetRemote "https://example.org/images/avatar-.de.jpg" }}
{{ $img := $img.Content | resources.FromString "assets/images/avatar-.de.jpg" }}
<img src="{{ $img.RelPermalink }}">
Pfad ist {{ $img.RelPermalink }}.
{{< /ghsvs/code >}}
{{< /ghsvs/callout >}}

```

That works with Hugo 0.99.1 without any issues and creates an output like:

![grafik](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/4/5/458dbb8d5ca6cb0947dcf4d7d718ae8bb90089a3.png)

In current 0.100.0 I get errors like:

```auto
Error: 
Error building site: "/path/content/Divers/Readme.md:140:1": 
failed to render shortcode "ghsvs/callout": 
failed to process shortcode: 
"/path/layouts/shortcodes/ghsvs/callout.html:x:13": 
execute of template failed: 
template: shortcodes/ghsvs/callout.html:x:13: 

executing "shortcodes/ghsvs/callout.html" at <$.Page.RenderString>: 

error calling RenderString: "/path/content/Divers/Readme.md:2:209": 
got closing shortcode, but none is open

```

---

<div class="post-metadata">

**Author:** ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)\
**Post date:** [May 31, 2022, 11:22pm UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/2 "2022-05-31T23:22:49Z")

</div>

I have changed my example code above because the main point is the nested shortcode

```auto
{{< ghsvs/code >}}

{{< /ghsvs/code >}}

```

I’ve uploaded a test repo. The error throwing code in [hugo-nested/\_index.md at main · GHSVS-de/hugo-nested · GitHub](https://github.com/GHSVS-de/hugo-nested/blob/main/content/_index.md)

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 1, 2022, 9:54am UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/3 "2022-06-01T09:54:15Z")

</div>

So, you problems lives here:

```auto
<div class="bd-callout bd-callout-{{ $css_class }}">
{{ .Inner | $.Page.RenderString }}
</div>

```

In Hugo 0.100.0 we added support for shortcodes in `RenderString` (a long sought after feature). `RenderString` was never meant to be used on the `.Inner` content of a shortcode, and it willl certainly not work that great now, as you have experienced.

---

<div class="post-metadata">

**Author:** ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)\
**Post date:** [June 1, 2022, 10:37am UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/4 "2022-06-01T10:37:57Z")

</div>

OK, bad news and I have to exchange again my content system for ducumentations.

Just to be said:  
I have read all comments on GitHub yesterday concerning “support for shortcodes in RenderString” and still I don’t understand what is supported where and why and what are the benefits in which case. I just see an unsolvable, grave B\C break and that RenderString is no longer supported inside my shortcodes which was the case in the past. How shall ““creative”” users know “what was never meant” for this or that?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 1, 2022, 11:02am UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/5 "2022-06-01T11:02:58Z")

</div>

> [@GhsvsDe](#):
>
> How shall ““creative”” users know “what was never meant” for this or that?

I’m sorry that your site broke. But it’s very hard to predict how thousands of users will use a certain function. The documentation is geared towards how and when to use certain features, not so much when not to use a certain function, and I’m not sure that is practical. But we surely have potential for improvements in that area (and that is being worked on).

Note that I’m pretty sure it’s possible to rewrite that code that fails for you, which I suspect will take less time than porting your site to another software.

---

<div class="post-metadata">

**Author:** ![id027102](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/id027102/32/15552_2.png) [@id027102](https://discourse.gohugo.io/u/id027102)\
**Post date:** [June 30, 2022, 11:14am UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/6 "2022-06-30T11:14:41Z")

</div>

Same problem when using markdownify  
…  
{{ .Inner | Markdownify }}  
…  
But no solution is gfound?  
Also good in 99.1 but not more in 100.0  
Blocking hugo on version 99 is the only possibility I see.  
Awaiting solution.  
Not the first time I need to rewrite some files due to hugo update

---

<div class="post-metadata">

**Author:** ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)\
**Post date:** [June 30, 2022, 12:08pm UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/7 "2022-06-30T12:08:47Z")

</div>

@id027102

> [@id027102](#):
>
> Awaiting solution.

I think the statement of bep is clear. There won’t be an universal solution. Maybe if you pay him for one 😉

```auto
{{ .Inner | $.Page.RenderString }}

```

does not fail in all contexts. In my case it depends on which nested shortcode I use.

Therefore (and because my “company partners” where nagging that I again want to change the system 😉 ) I have added an additional and optional boolean parameter and my main shortcode looka now like this:

```auto
{{- /*
- Usage: `callout "type"`[false], where `type` is one of info (default), danger, or warning.
- @since Hugo 100.0 this shortcode crashes if a < ghsvs/code > is embedded.
  - therefore parameter markdownify was introduced, which must be explicitly set to false to bypass $.Page.RenderString.
*/ -}}

{{- $css_class := .Get 0 | default "info" -}}
{{- $markdownify := .Get 1 | default true -}}
<div class="bd-callout bd-callout-{{ $css_class }}">
{{- if $markdownify -}}
  {{ .Inner | $.Page.RenderString }}
{{- else -}}
  {{ .Inner }}
{{- end -}}
</div>

```

In cases where the rendered result looks “weird” there is now a simplified second shortcode and my “company partners” have to live with the discomfort to restructure their content (sometimes) 😉

“”“Creativity”“” rules! (…and the result is sometimes more exhausting.)

---

<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:** [July 2, 2022, 12:09pm UTC](https://discourse.gohugo.io/t/since-0-100-0-many-error-calling-renderstring/38878/8 "2022-07-02T12:09:25Z")

</div>

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