Recently I came across seeing strange results in hugo server generated pages, that were different from expectation.. hugo should have parsed the shortcode snippets with comment chars in a special way, but that didn't happen.
Turns out that hugo server was throwing an error.. but it still generated the full pages except for parsing shortcodes. This led to quite some confusion.. details in the link at the end of this issue.
Can hugo introduce a warning message at the top of the generated HTML body.. some sort of banner that says "Hey, check the ERROR on terminal", or even even better!! Put out that Error in that banner when running hugo server?
Ideally there is some data structure on Page where all error messages and any other dev-time info (e.g. debug info per #3514) can be collected, and then the renderer puts all of it in a banner or whatever makes sense for the output format.
Ideally there is some data structure on Page where all error messages and any other dev-time info (e.g. debug info per #3514) can be collected
I don't think it would make sense to pin this to a Page -- that would be hard and not worth it. The viable option is to ask: It this was regular hugo and we would exit -1, then show "that error" to the user.
That makes sense. My suggestion was if the solution was along the lines of the title of this issue, "Show the Error messages in the HTML".
Or are you saying show "that error" on every page... i.e. hugo server (not the renderers) would simply insert it as a banner at the top?
Or are you saying show "that error" on every page... i.e.
hugoserver would simply insert it as a banner at the top (not something the renderers would do)?
I would try to make it as simple as possible. Render it on 1 or every page makes no practical difference for the user (he/she is only looking at one). We have a list of "recently viewed" pages stored away (used for the "rast render mode") and could use that to only render the error message on "the current", but I would only do that if it was really simple.
The error message should anyhow be as detailed as in the console so the user would know what page it is about (if not the current).
An alternative approach that may be worth visiting is to use JavaScript (see the LiveReload integration) to trigger some kind of alert.
Why wouldn't hugo server exit -1 in the same way as regular hugo? Wouldn't that be simplest?
Is it because it makes sense to render and display whatever did work to make debugging easier?
Why wouldn't聽hugo server聽exit -1聽in the same way as regular聽hugo? Wouldn't that be simplest?
This is a not uncommon edit session for me:
hugo serverERROR in the console.ERROR... Hmm ... The error is still there.ERROR goes away!Imagine that same sequence if we exit -1 on errors in hugo server:
hugo serverERROR in the console.ERROR ERROR goes away!I think the current behaviour is more user friendly.
Most helpful comment
This is a not uncommon edit session for me:
hugo serverERRORin the console.ERROR... Hmm ... The error is still there.ERRORgoes away!Imagine that same sequence if we
exit -1on errors inhugo server:hugo serverERRORin the console.ERRORERRORgoes away!I think the current behaviour is more user friendly.