page.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {% extends "base.html" %}
  2. {% block title %}{{ page.title }}{% endblock title %}
  3. {% block header_logo %}
  4. <p class="header-title">{{ config.title }} | {{ page.title }}</p>
  5. {% endblock header_logo %}
  6. {% block content %}
  7. <!-- List parent -->
  8. {% set current_path = page.path %}
  9. {% if "/" in current_path %}
  10. {% set last_char = current_path | split(pat="/") | last %}
  11. {% if last_char == "" %}
  12. {% set parent_dirs = current_path | split(pat="/") | slice(end=-2) %}
  13. {% else %}
  14. {% set parent_dirs = current_path | split(pat="/") | slice(end=-1) %}
  15. {% endif %}
  16. {% set parent_href = parent_dirs | join(sep="/") %}
  17. <a href="{{ parent_href }}">Back up</a>
  18. {% endif %}
  19. <!-- Table of Contents -->
  20. {% if page.toc %}
  21. <div>
  22. <p>Table of Contents</p>
  23. <ul>
  24. {% for h1 in page.toc %}
  25. <li>
  26. <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
  27. {% if h1.children %}
  28. <ul>
  29. {% for h2 in h1.children %}
  30. <li>
  31. <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
  32. </li>
  33. {% endfor %}
  34. </ul>
  35. {% endif %}
  36. </li>
  37. {% endfor %}
  38. </ul>
  39. </div>
  40. {% endif %}
  41. {{ page.content | safe }}
  42. {% endblock content %}