layout.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {% extends '!layout.html' %}
  2. {% block footer %}
  3. {{ super() }}
  4. <div class="sdk-footer">
  5. <div class="sdk-footer__inner">
  6. <div class="sdk-footer__left">
  7. <strong>{{ project|e }}</strong>
  8. {% if release %}<span class="sdk-footer__sep">•</span> 版本:{{ release|e }}{% endif %}
  9. </div>
  10. <div class="sdk-footer__right">
  11. 构建时间:<span id="sdk-build-time"></span>
  12. </div>
  13. </div>
  14. </div>
  15. <script>
  16. (function(){
  17. try {
  18. var el = document.getElementById('sdk-build-time');
  19. if (el) {
  20. var d = new Date(document.lastModified);
  21. el.textContent = d.toLocaleString();
  22. }
  23. } catch(e) {}
  24. })();
  25. </script>
  26. {% endblock %}
  27. {# 将 giscus 插入到正文(内容)块的末尾,紧跟文章内容之后 #}
  28. {% block content %}
  29. {{ super() }}
  30. {% if giscus and giscus.get('enabled') and giscus.get('repo') and giscus.get('repo_id') and (giscus.get('category_id') or giscus.get('category')) %}
  31. <div id="giscus_thread" class="giscus" style="margin: 2rem 0;"></div>
  32. <script src="https://giscus.app/client.js"
  33. data-repo="{{ giscus.get('repo') }}"
  34. data-repo-id="{{ giscus.get('repo_id') }}"
  35. {% if giscus.get('category_id') %}
  36. data-category-id="{{ giscus.get('category_id') }}"
  37. {% elif giscus.get('category') %}
  38. data-category="{{ giscus.get('category') }}"
  39. {% endif %}
  40. data-mapping="{{ giscus.get('mapping', 'pathname') }}"
  41. data-strict="{{ giscus.get('strict', 0) }}"
  42. data-reactions-enabled="{{ giscus.get('reactions_enabled', 1) }}"
  43. data-emit-metadata="{{ giscus.get('emit_metadata', 0) }}"
  44. data-input-position="{{ giscus.get('input_position', 'bottom') }}"
  45. data-theme="{{ giscus.get('theme', 'preferred_color_scheme') }}"
  46. data-lang="{{ giscus.get('lang', 'zh-CN') }}"
  47. {% if giscus.get('lazy') %} data-loading="lazy"{% endif %}
  48. crossorigin="anonymous"
  49. async>
  50. </script>
  51. {% endif %}
  52. {% endblock %}
  53. {% block extrahead %}
  54. {{ super() }}
  55. {# 将 edit_base_url 暴露为 window 变量与 meta,供前端脚本读取 #}
  56. {% if edit_base_url %}
  57. <script>window.SPHINX_EDIT_BASE_URL = {{ edit_base_url|tojson|safe }};</script>
  58. <meta name="edit-base-url" content="{{ edit_base_url }}">
  59. {% endif %}
  60. {% endblock %}