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.
 
 
 
 
 

46 lines
1.5 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. <time datetime="{{ res.meta.created.strftime('%Y-%m-%d') }}">
  12. Posted: {{ res.meta.created.strftime('%a, %d %b %Y') }}
  13. </time>
  14. </article>
  15. {% endmacro %}
  16. {% macro render_nav(menu, cls=None) -%}
  17. {% if menu -%}
  18. <nav {{'class='~cls if cls }}>
  19. <ul>
  20. {% for item in menu -%}
  21. {% set active = False -%}
  22. {% if item.type == 'page' -%}
  23. {% set active = (resource.url ==
  24. site.content.resource_from_relative_path(item.url).url) -%}
  25. {% else -%}
  26. {% set active = (node ==
  27. site.content.node_from_relative_path(item.url)) -%}
  28. {%- endif %}
  29. {% set classes = ['button', 'white'] -%}
  30. {% do classes.append('active') if active -%}
  31. {% do classes.append(item.css_class) if item.css_class -%}
  32. <li>
  33. <a title="{{ item.description }}"
  34. class="{{ classes|join(' ') }}"
  35. href="{{ content_url(item.url) }}">
  36. {{ item.name }}
  37. </a>
  38. </li>
  39. {%- endfor %}
  40. </ul>
  41. </nav>
  42. {%- endif %}
  43. {%- endmacro %}