The blog.
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.
 
 
 
 

40 lines
1.4 KiB

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