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.
 
 
 
 

50 lines
1.7 KiB

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