aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-05-12 11:43:20 +0200
committerBjørn Erik Pedersen <[email protected]>2022-05-14 13:40:56 +0200
commit5c96bda70a7afb2ce97cbb3cd70c64fc8cb94446 (patch)
tree394a557b0dc7db1f6753cf2a09e8cb0577f18442 /hugolib/shortcode.go
parent4a96df96d958a8ce122f103c4b417eaba52e6cb1 (diff)
downloadhugo-5c96bda70a7afb2ce97cbb3cd70c64fc8cb94446.tar.gz
hugo-5c96bda70a7afb2ce97cbb3cd70c64fc8cb94446.zip
errors: Misc improvements
* Redo the server error template * Always add the content file context if relevant * Remove some now superflous error string matching * Move the server error template to _server/error.html * Add file context (with position) to codeblock render blocks * Improve JS build errors Fixes #9892 Fixes #9891 Fixes #9893
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index 42877b537..f8cda6b8d 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -270,7 +270,6 @@ const (
innerNewlineRegexp = "\n"
innerCleanupRegexp = `\A<p>(.*)</p>\n\z`
innerCleanupExpand = "$1"
- pageFileErrorName = "page.md"
)
func renderShortcode(
@@ -299,7 +298,7 @@ func renderShortcode(
var err error
tmpl, err = s.TextTmpl().Parse(templName, templStr)
if err != nil {
- fe := herrors.NewFileError(pageFileErrorName, err)
+ fe := herrors.NewFileError(p.File().Filename(), err)
pos := fe.Position()
pos.LineNumber += p.posOffset(sc.pos).LineNumber
fe = fe.UpdatePosition(pos)
@@ -392,7 +391,7 @@ func renderShortcode(
result, err := renderShortcodeWithPage(s.Tmpl(), tmpl, data)
if err != nil && sc.isInline {
- fe := herrors.NewFileError("shortcode.md", err)
+ fe := herrors.NewFileError(p.File().Filename(), err)
pos := fe.Position()
pos.LineNumber += p.posOffset(sc.pos).LineNumber
fe = fe.UpdatePosition(pos)