{% macro list_posts(section=false, count=0, taxonomy=false) %} {% if taxonomy == false and section != false %} {% set section = get_section(path=section~"/_index.md") %} {% endif %} {% for page in section.pages %} {% if loop.index > count and count != 0 %} {% break %} {% endif %} {{ self::print_article(page=page, author=false) }} {% endfor %} {% endmacro %} {% macro print_article(page, author=true) %} <article data-title="{{ page.title | lower }}"> <h2><a href="{{ page.permalink }}">{{ page.title }}</a></h2> {{ page.summary | safe }} {{ self::page_info(page=page, author=author) }} </article> {% endmacro %} {% macro page_info(page, author=true) %} {% if page.date %} <div class="info"> <span class="date">{{ page.date }}</span> {%- if page.extra.author and author -%} , <span class="author">{{ page.extra.author }}</span> {% endif %} {% if page.taxonomies.categories %} <div class="taxonomy"> {{ self::list_taxonomy(kind="categories", page=page.taxonomies.categories, prepend="#") }} </div> {% endif %} </div> {% endif %} {% endmacro %} {% macro page_updates(page) %} {% if page.extra.updates %} <div class="updates"> Page updates: <ul> {% for update in page.extra.updates %} <li>{{ update.date }} — {{ update.description }}</li> {% endfor %} </ul> </div> {% endif %} {% endmacro %} {% macro toc() %} {% if page.toc and not page.extra.notoc %} <ul> {% for h1 in page.toc %} <li> <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a> {% if h1.children %} <ul> {% for h2 in h1.children %} <li> <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a> </li> {% endfor %} </ul> {% endif %} </li> {% endfor %} </ul> {% endif %} {% endmacro %} {% macro list_taxonomy(kind, page=false, prepend="") %} {# Option `kind` must always be set and specifies the wanted taxonomy. If `page` is set, this macro only prints items specific for this page. Otherwise it prints all items. It expects `page.taxonomies.<taxonomy>`. Option `prepend` can be used to prepend any string to the item name. #} <ul> {% if page != false %} {% for term in page %} <li class="item"><a href="{{ get_taxonomy_url(kind=kind, name=term) | safe }}">{{ prepend }}{{ term }}</a></li> {% endfor %} {% else %} {% set taxonomy = get_taxonomy(kind=kind) %} {% for term in taxonomy.items %} <li class="item"><a href="{{ term.permalink | safe }}">{{ prepend }}{{ term.name }}</a></li> {% endfor %} {% endif %} </ul> {% endmacro %}