page.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. {% extends "./layout.html" %}
  2. {% block title %}{{ page.title }} · {{ super() }}{% endblock %}
  3. {% block description %}{{ page.description }}{% endblock %}
  4. {% block head %}
  5. {{ super() }}
  6. {% if page.next and page.next.path %}
  7. <link rel="next" href="{{ page.next.path|resolveFile }}" />
  8. {% endif %}
  9. {% if page.previous and page.previous.path %}
  10. <link rel="prev" href="{{ page.previous.path|resolveFile }}" />
  11. {% endif %}
  12. {% endblock %}
  13. {% block javascript %}
  14. <noscript>
  15. <style>
  16. .honkit-cloak {
  17. display: block !important;
  18. }
  19. </style>
  20. </noscript>
  21. <script>
  22. // Restore sidebar state as critical path for prevent layout shift
  23. function __init__getSidebarState(defaultValue){
  24. var baseKey = "";
  25. var key = baseKey + ":sidebar";
  26. try {
  27. var value = localStorage[key];
  28. if (value === undefined) {
  29. return defaultValue;
  30. }
  31. var parsed = JSON.parse(value);
  32. return parsed == null ? defaultValue : parsed;
  33. } catch (e) {
  34. return defaultValue;
  35. }
  36. }
  37. function __init__restoreLastSidebarState() {
  38. var isMobile = window.matchMedia("(max-width: 600px)").matches;
  39. if (isMobile) {
  40. // Init last state if not mobile
  41. return;
  42. }
  43. var sidebarState = __init__getSidebarState(true);
  44. var book = document.querySelector(".book");
  45. // Show sidebar if it enabled
  46. if (sidebarState && book) {
  47. book.classList.add("without-animation", "with-summary");
  48. }
  49. }
  50. try {
  51. __init__restoreLastSidebarState();
  52. } finally {
  53. var book = document.querySelector(".book");
  54. book.classList.remove("honkit-cloak");
  55. }
  56. </script>
  57. <script src="{{ "gitbook.js"|resolveAsset }}"></script>
  58. <script src="{{ "theme.js"|resolveAsset }}"></script>
  59. {% for resource in plugins.resources.js %}
  60. {% if resource.url %}
  61. <script src="{{ resource.url }}"></script>
  62. {% else %}
  63. <script src="{{ resource.path|resolveAsset }}"></script>
  64. {% endif %}
  65. {% endfor %}
  66. {% endblock %}
  67. {% block body %}
  68. <div class="book honkit-cloak">
  69. <div class="book-summary">
  70. {% block book_sidebar %}
  71. {% block search_input %}{% endblock %}
  72. {% block book_summary %}
  73. <nav role="navigation">
  74. {% include "website/summary.html" %}
  75. </nav>
  76. {% endblock %}
  77. {% endblock %}
  78. </div>
  79. <div class="book-body">
  80. {% block book_body %}
  81. <div class="body-inner">
  82. {% block book_inner %}
  83. {% include "website/header.html" %}
  84. <div class="page-wrapper" tabindex="-1" role="main">
  85. <div class="page-inner">
  86. {% block search_results %}
  87. <section class="normal markdown-section">
  88. {% block page %}
  89. {{ page.content|safe }}
  90. {% endblock %}
  91. </section>
  92. {% endblock %}
  93. </div>
  94. </div>
  95. {% endblock %}
  96. </div>
  97. {% block book_navigation %}
  98. {% if page.previous and page.previous.path %}
  99. <a href="{{ page.previous.path|resolveFile }}{{ page.previous.anchor }}" class="navigation navigation-prev {% if not (page.next and page.next.path) %}navigation-unique{% endif %}" aria-label="Previous page: {{ page.previous.title }}">
  100. <i class="fa fa-angle-left"></i>
  101. </a>
  102. {% endif %}
  103. {% if page.next and page.next.path %}
  104. <a href="{{ page.next.path|resolveFile }}{{ page.next.anchor }}" class="navigation navigation-next {% if not (page.previous and page.previous.path) %}navigation-unique{% endif %}" aria-label="Next page: {{ page.next.title }}">
  105. <i class="fa fa-angle-right"></i>
  106. </a>
  107. {% endif %}
  108. {% endblock %}
  109. {% endblock %}
  110. </div>
  111. <script>
  112. var gitbook = gitbook || [];
  113. gitbook.push(function() {
  114. gitbook.page.hasChanged({{ template.getJSContext()|dump|safe }});
  115. });
  116. </script>
  117. </div>
  118. {% endblock %}