diff --git a/public/src/widgets.js b/public/src/widgets.js index 494546c023..de2d0e8697 100644 --- a/public/src/widgets.js +++ b/public/src/widgets.js @@ -9,17 +9,18 @@ module.exports.render = function (template) { locations.forEach(function (location) { let area = $('#content [widget-area="' + location + '"],#content [data-widget-area="' + location + '"]').eq(0); - if (area.length) { + const widgetsAtLocation = ajaxify.data.widgets[location] || []; + if (area.length || !widgetsAtLocation.length) { return; } - const widgetsAtLocation = ajaxify.data.widgets[location] || []; let html = ''; - widgetsAtLocation.forEach(function (widget) { html += widget.html; }); - + if (!html) { + return; + } if (location === 'footer' && !$('#content [widget-area="footer"],#content [data-widget-area="footer"]').length) { $('#content').append($('