<script>
  function load_comment(){
    if(!document.getElementById("waline_container"))return;
    stellar.loadCSS('<%- theme.comments.waline.css %>');
    stellar.loadScript('<%- theme.comments.waline.js %>', {defer:true}).then(function () {
      const el = document.getElementById("waline_container");
      var path = el.getAttribute('comment_id');
      if (!path) {
        path = decodeURI(window.location.pathname);
      }
      Waline.init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
        el: '#waline_container',
        path: path,
      }));
    });
  }
  window.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded and parsed');
    load_comment();
  });

</script>
