A fork of hyde, the static site generation. Some patches will be pushed upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
1.5 KiB

  1. {# Generates the main and basic menu from context data in the site's
  2. configuration file.
  3. #}
  4. {% macro render_basic_menu() -%}
  5. <ul class="basic">
  6. {% for menu_item in menu %}
  7. <li><a {% if (menu_item.url == resource.relative_path) %}class="selected" {% endif -%}
  8. href="{{ content_url(menu_item.url) }}">{{ menu_item.title }}</a></li>
  9. {% endfor %}
  10. </ul>
  11. {%- endmacro %}
  12. {# Generates the advanced menu from all files located in the content/advanced
  13. folder. Only advanced section files have 'index' metadata, so we can be
  14. certain that no other files will creep in.
  15. #}
  16. {% macro render_advanced_menu() -%}
  17. <ul class="advanced">
  18. {% for res in site.content.walk_resources_sorted_by_index() %}
  19. <li><a {% if (res.url == resource.url) %}class="selected" {% endif -%}
  20. href="{{ res.full_url }}">{{ res.meta.title }}</a></li>
  21. {% endfor %}
  22. </ul>
  23. {%- endmacro %}
  24. {# Advanced topics macro. Renders navigation at the end of an advanced
  25. article. It also depends on 'index' metadata.
  26. #}
  27. {% macro render_bottom_article_nav() %}
  28. <div class="bottom_article_nav">
  29. {% if resource.next_by_index is not none -%}
  30. <div class="next"><a href="{{ resource.next_by_index.full_url }}">
  31. {{ resource.next_by_index.meta.title }}</a>
  32. &gt;</div>
  33. {%- endif %}
  34. {% if resource.prev_by_index is not none -%}
  35. <div class="prev">&lt; <a href="{{ resource.prev_by_index.full_url }}">
  36. {{ resource.prev_by_index.meta.title }}</a>
  37. </div>
  38. {%- endif %}
  39. </div>
  40. {% endmacro %}