Log a clear console error when the cookie banner is missing
Silently returning made a missing banner.html integration indistinguishable from a working page, which cost real debugging time. Fail loud instead, pointing at the README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
(function () {
|
||||
var KEY = 'cookie_consent';
|
||||
var banner = document.getElementById('cookie-banner');
|
||||
if (!banner) return;
|
||||
if (!banner) {
|
||||
console.error(
|
||||
'[hugo_cookie_consent] #cookie-banner not found in the DOM. ' +
|
||||
'Did you include the hugo_cookie_consent/banner.html partial in your site\'s layout? ' +
|
||||
'See the module README ("Installation in your Hugo site").'
|
||||
);
|
||||
return;
|
||||
}
|
||||
updateStatus();
|
||||
|
||||
var consent = localStorage.getItem(KEY);
|
||||
|
||||
Reference in New Issue
Block a user