_layouts/default.html in minima-rock-0.8.0 vs _layouts/default.html in minima-rock-0.8.1

- old
+ new

@@ -15,16 +15,18 @@ {%- include footer.html -%} </body> - <script> - const imgs = [ - {%- for item in site.data.backgrounds -%} - '{{ item.name }}', - {%- endfor -%} - ]; - const date = new Date(); - const index = date.getDay() % imgs.length; - document.body.style.backgroundImage = `url('{{ site.baseurl }}${imgs[index]}')`; - </script> + {% if site.data.backgrounds %} + <script> + const imgs = [ + {%- for item in site.data.backgrounds -%} + '{{ item.name }}', + {%- endfor -%} + ]; + const date = new Date(); + const index = date.getDay() % imgs.length; + document.body.style.backgroundImage = `url('{{ site.baseurl }}${imgs[index]}')`; + </script> + {% endif %} </html>