<% if (theme.disqus_shortname){ %>
<script>
  var disqus_shortname = '<%= theme.disqus_shortname %>';
  <% if (page.permalink){ %>
  var disqus_url = '<%= page.permalink %>';
  <% } %>
  (function(){
    var dsq = document.createElement('script');
    dsq.async = true;
    dsq.src = 'https://' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>
<% } %>

<%- js('js/jquery-3.6.4.min.js') %>

<% if (theme.fancybox){ %>
  <%- js('fancybox/jquery.fancybox.min.js') %>
<% } %>

<%- js('js/script') %>
<%- partial('gauges-analytics') %>

<% if(theme.valine.enable && theme.valine.appId && theme.valine.appKey){ %>
  <%- js('https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js') %>
<script>
    var GUEST_INFO = ['nick','mail','link'];
    var guest_info = '<%= theme.valine.guest_info %>'.split(',').filter(function(item){
        return GUEST_INFO.indexOf(item) > -1
    });
    var notify = '<%= theme.valine.notify %>' == true;
    var verify = '<%= theme.valine.verify %>' == true;
    new Valine({
        el: '.vcomment',
        notify: notify,
        verify: verify,
        appId: "<%= theme.valine.appId %>",
        appKey: "<%= theme.valine.appKey %>",
        placeholder: "<%= theme.valine.placeholder %>",
        pageSize:'<%= theme.valine.pageSize %>',
        avatar:'<%= theme.valine.avatar %>',
        lang:'<%= theme.valine.lang %>'
    });
</script>
<% } %>