<aside id="sidebar">
  <% if (theme.injector.sidebar_begin) { %>
    <%- render(theme.injector.sidebar_begin, 'html'); %>
  <% } %>
  <% if (theme.player.aplayer.enable && !theme.player.meting.enable && theme.player.aplayer.options.fixed !== true) { %>
    <div id="aplayer" theme="var(--color-link)" data-aos="<%= theme.animation.options.home.sidebar %>"></div>
  <% } %>
  <% if (theme.player.meting.enable && theme.player.aplayer.options.fixed !== true) { %>
    <meting-js
      theme="var(--color-link)"
      <% if (theme.player.meting.options.id != null) { %>id="<%= theme.player.meting.options.id %>"<% } %>
      <% if (theme.player.meting.options.server != null) { %>server="<%= theme.player.meting.options.server %>"<% } %>
      <% if (theme.player.meting.options.type != null) { %>type="<%= theme.player.meting.options.type %>"<% } %>
      <% if (theme.player.meting.options.auto != null) { %>auto="<%= theme.player.meting.options.auto %>"<% } %>
      <% if (theme.player.aplayer.options.fixed != null) { %>fixed="<%= theme.player.aplayer.options.fixed %>"<% } %>
      <% if (theme.player.aplayer.options.autoplay != null) { %>autoplay="<%= theme.player.aplayer.options.autoplay %>"<% } %>
      <% if (theme.player.aplayer.options.loop != null) { %>loop="<%= theme.player.aplayer.options.loop %>"<% } %>
      <% if (theme.player.aplayer.options.order != null) { %>order="<%= theme.player.aplayer.options.order %>"<% } %>
      <% if (theme.player.aplayer.options.preload != null) { %>preload="<%= theme.player.aplayer.options.preload %>"<% } %>
      <% if (theme.player.aplayer.options.volume != null) { %>volume="<%= theme.player.aplayer.options.volume %>"<% } %>
      <% if (theme.player.aplayer.options.mutex != null) { %>mutex="<%= theme.player.aplayer.options.mutex %>"<% } %>
      <% if (theme.player.aplayer.options.listFolded != null) { %>list-folded="<%= theme.player.aplayer.options.listFolded %>"<% } %>
      <% if (theme.player.aplayer.options.lrcType != null) { %>lrc-type="<%= theme.player.aplayer.options.lrcType %>"<% } %>
    ></meting-js>
  <% } %>
  <div class="sidebar-wrapper <% if (is_post()) { %>wrap-sticky<% } %>">
    <div class="sidebar-wrap" data-aos="<%= theme.animation.options.home.sidebar %>">
      <% if (is_post()) { %>
        <% if (post.toc === false) { %>
          <%- partial_lang('sidebar/common-sidebar', null, { cache: !config.relative_link, lang: page.lang }) %>
        <% } else if (post.toc !== true && theme.toc === false) { %>
          <%- partial_lang('sidebar/common-sidebar', null, { cache: !config.relative_link, lang: page.lang }) %>
        <% } else { %>
          <div class="sidebar-toc-sidebar"><%- partial('sidebar/toc-sidebar') %></div>
          <div class="sidebar-common-sidebar hidden"><%- partial_lang('sidebar/common-sidebar', null, { cache: !config.relative_link, lang: page.lang }) %></div>
        <% } %>
      <% } else { %>
        <%- partial_lang('sidebar/common-sidebar', null, { cache: !config.relative_link, lang: page.lang }) %>
      <% } %>
      <% if (is_post()) { %>
        <% if (post.toc === false) { %>
        <% } else if (post.toc !== true && theme.toc === false) { %>
        <% } else { %>
          <div class="sidebar-btn-wrapper" style="position:static">
            <div class="sidebar-toc-btn current"></div>
            <div class="sidebar-common-btn"></div>
          </div>
        <% } %>
      <% } %>
    </div>
  </div>

  <div class="sidebar-widget">
  <% if (!is_post() && theme.widgets) { %>
    <% theme.widgets.forEach((widget) => { %>
      <%- partial_lang('_widget/' + widget, null, { cache: !config.relative_link, lang: page.lang }) %>
    <% }) %>
  <% } %>
  </div>
  <% if (theme.injector.sidebar_end) { %>
    <%- render(theme.injector.sidebar_end, 'html'); %>
  <% } %>
</aside>
