The Glør restaurant site builds its menu cards in the browser with JavaScript template literals — the strings wrapped in backticks. A comfortable way to write HTML inside code.
What happened
I opened the site and the menu was completely empty. No dishes, no obvious error — just a console message naming an ordinary English word as if it were an undefined variable.
The cause
Inside one of the templates I had written a comment explaining part of the HTML, and the comment contained a backtick. That backtick closed the template early. The rest of the comment was then read as JavaScript, and its first word was taken for a variable that did not exist.
Why no check caught it
The file was syntactically valid. Linters said it was fine — because it really was valid code, just not the code I meant. The bug only shows up at runtime.
It shipped twice, and blanked the menu both times.
The rule
Now there is a simple rule: no comments inside templates, ever. Any explanation goes above the template as an ordinary // comment, so a backtick can never end up inside the string.
What I learned
- Valid code is not the same as correct code.
- When the same bug happens twice, the fix is a rule, not more attention.
- A strange error naming a word from a normal sentence usually means a string ended too soon.