Repository: gohugoio/hugo (language: go)

Issue:
Incorrect value in error message
```text
{{ $opts := dict "markup" "foo" }}
{{ "something" | .RenderString $opts }}
```

Expected error message:

> no content renderer found for markup "foo"

Actual error message:

> no content renderer found for markup "markdown"


Discussion / hints:

Fix patch:
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go
index 1c4f13d3bbe..fdd7d7793a4 100644
--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -731,7 +731,7 @@ func (p *pageMeta) newContentConverter(ps *pageState, markup string) (converter.
 	}
 	cp := p.s.ContentSpec.Converters.Get(markup)
 	if cp == nil {
-		return converter.NopConverter, fmt.Errorf("no content renderer found for markup %q", p.markup)
+		return converter.NopConverter, fmt.Errorf("no content renderer found for markup %q", markup)
 	}
 
 	var id string


Test patch:
diff --git a/hugolib/integration_test.go b/hugolib/integration_test.go
index 417fe212993..1109694b1f5 100644
--- a/hugolib/integration_test.go
+++ b/hugolib/integration_test.go
@@ -14,6 +14,7 @@
 package hugolib_test
 
 import (
+	"strings"
 	"testing"
 
 	"github.com/gohugoio/hugo/hugolib"
@@ -87,3 +88,29 @@ tags: ['T1']
 	)
 
 }
+
+// Issue #11538
+func TestRenderStringBadMarkupOpt(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- layouts/index.html --
+{{ $opts := dict "markup" "foo" }}
+{{ "something" | .RenderString $opts }}
+	`
+
+	b := hugolib.NewIntegrationTestBuilder(
+		hugolib.IntegrationTestConfig{
+			T:           t,
+			TxtarString: files,
+		},
+	)
+
+	_, err := b.BuildE()
+
+	want := `no content renderer found for markup "foo"`
+	if !strings.Contains(err.Error(), want) {
+		t.Errorf("error msg must contain %q, error msg actually contains %q", want, err.Error())
+	}
+
+}