BaySec website source
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.
 
 
 
 
 

43 lines
1.4 KiB

  1. {% macro render_link(res, class=None) %}
  2. {% refer to res.relative_path as post %}
  3. <a href="{{ content_url(res.url) }}">{{ res.meta.title }}</a>
  4. {% endmacro %}
  5. {% macro render_excerpt(res, class=None) %}
  6. {% refer to res.relative_path as post %}
  7. <article {{'class='~class if class }}>
  8. <h3><a href="{{ content_url(res.url) }}">{{ res.meta.title }}</a></h3>
  9. <a href="{{ content_url(res.url) }}">{{ post.image|markdown|typogrify }}</a>
  10. {{ post.excerpt|markdown|typogrify }}
  11. </article>
  12. {% endmacro %}
  13. {% macro render_nav(menu, cls=None) -%}
  14. {% if menu -%}
  15. <nav {{'class='~cls if cls }}>
  16. <ul>
  17. {% for item in menu -%}
  18. {% set active = False -%}
  19. {% if item.type == 'page' -%}
  20. {% set active = (resource.url ==
  21. site.content.resource_from_relative_path(item.url).url) -%}
  22. {% else -%}
  23. {% set active = (node ==
  24. site.content.node_from_relative_path(item.url)) -%}
  25. {%- endif %}
  26. {% set classes = ['button', 'white'] -%}
  27. {% do classes.append('active') if active -%}
  28. {% do classes.append(item.css_class) if item.css_class -%}
  29. <li>
  30. <a title="{{ item.description }}"
  31. class="{{ classes|join(' ') }}"
  32. href="{{ content_url(item.url) }}">
  33. {{ item.name }}
  34. </a>
  35. </li>
  36. {%- endfor %}
  37. </ul>
  38. </nav>
  39. {%- endif %}
  40. {%- endmacro %}