aboutsummaryrefslogtreecommitdiff
path: root/templates/macros/macros.html
blob: 454854a6c7a0f1b0a07c098377148cd3111600bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{%- macro title(page) %}
        <h1><a href="{{ page.permalink | safe }}">{{ page.title }}</a></h1>
        <span>{{ page.date | date(format="%B %d, %Y") }}
        {%- if page.taxonomies.authors and config.taxonomies %} by
          {%- for author in page.taxonomies.authors %}
          {%- if author_flag %} and {% endif %}
          <a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}">{{ author }}</a>
          {%- set_global author_flag = true %}
          {%- endfor %}
        {%- elif config.extra.author and config.extra.author_show %} by {{ config.extra.author }}
        {%- endif %}
{%- if page.taxonomies.categories %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind="categories", name=cat) | safe }}">{{ cat }}</a>{% endfor %}]{% endif %}
{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">{{ tag }}</a> {% endfor -%}{%- endif %}
{%- if config.extra.readtime %} - {{ page.reading_time }} {{ config.extra.readtime_string | default(value="min") }} {% endif %}
        </span>
{%- endmacro title %}


{%- macro footer(page) %}
<h3><a href="#">Back to top</a></h3>
{%- endmacro footer %}


{%- macro pagination(paginator)%}
  {%- if paginator.number_pagers > 1 %}
      <nav>
          <ul>
            {%- if paginator.previous %}<li><a href="{{ paginator.previous | safe }}">&#60; Previous</a></li>{% endif %}
            {%- for i in range(start=1, end=paginator.number_pagers+1) %}
            <li>
              {%- if i == paginator.current_index %}
              <a class="cnav" href="#">{{i}}</a>
              {%- elif i > 1 %}
              <a href="{{paginator.base_url | safe }}{{i ~ '/'}}">{{i}}</a>
              {%- else %}
              <a href="{{paginator.first | safe }}">{{i}}</a>
              {%- endif %}
            </li>
            {%- endfor %}
            {%- if paginator.next %}<li><a href="{{ paginator.next | safe }}">Next &#62;</a></li>{% endif %}
          </ul>
      </nav>
  {%- endif %}
{%- endmacro %}