home.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {% extends "base.html" %}
  2. {% block title %}{{ section.title }}{% endblock title %}
  3. {% block header_logo %}
  4. <p class="header-title">
  5. <img class="logo" src="{{ get_url(path="banner.png") }}" alt="{{ section.title }}" title="Logo"/>
  6. </p>
  7. {% endblock header_logo %}
  8. {% block content %}
  9. <h1>Home</h1>
  10. <!-- Table of Contents -->
  11. {% if section.toc %}
  12. <div>
  13. <h2 id="toc">Table of Contents</h2>
  14. <ul>
  15. {# NOTE: static toc for dynamic template rather than md content. #}
  16. <li>
  17. <a href="#">Home</a>
  18. <ul>
  19. <li>
  20. <a href="#toc">Table of Contents</a>
  21. </li>
  22. <li>
  23. <a href="#recent">Recent Entries</a>
  24. </li>
  25. </ul>
  26. </li>
  27. {% for h1 in section.toc %}
  28. <li>
  29. <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
  30. {% if h1.children %}
  31. <ul>
  32. {% for h2 in h1.children %}
  33. <li>
  34. <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
  35. </li>
  36. {% endfor %}
  37. </ul>
  38. {% endif %}
  39. </li>
  40. {% endfor %}
  41. </ul>
  42. </div>
  43. {% endif %}
  44. <!-- Recent Entries -->
  45. {% set archive_section = get_section(path="archive/_index.md") %}
  46. {% set all_pages = archive_section.pages %}
  47. {% set sorted_pages = all_pages | sort(attribute="date") | reverse | slice(end=3) %}
  48. {% if sorted_pages %}
  49. <div>
  50. <h2 id="recent">Recent Entries</h2>
  51. <ul>
  52. {% for page in sorted_pages %}
  53. <li>
  54. <p>{% if page.date %}{{ page.date }} &bullet;{% endif %}
  55. <a href="{{ page.permalink }}">{{ page.title }}</a>
  56. </p>
  57. {% if page.description %}
  58. <p>{{ page.description }}</p>
  59. {% elif page.summary %}
  60. <p>{{ page.summary }}</p>
  61. {% else %}
  62. <p>{{ page.title }}....</p>
  63. {% endif %}
  64. </li>
  65. {% endfor %}
  66. </ul>
  67. </div>
  68. {% endif %}
  69. {{ section.content | safe }}
  70. {% endblock content %}