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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
{%- macro title_post(page) %}
<h1><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1>
{%- endmacro title_post %}
{%- macro meta_post(page) %}
<span{%- if config.extra.meta_post.size %} class="{{ config.extra.meta_post.size }}"{% endif %}>
{#- Author #}
{%- if page.taxonomies.authors and config.taxonomies %}
{%- for author in page.taxonomies.authors %}
{%- if author_flag %} and {% endif %}
<a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a>
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif config.extra.author and config.extra.meta_post.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }}
{%- endif %}
{#- divider #}
{%- if config.extra.meta_post.author %}
{%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}
{%- endif %}
{%- endif %}
{#- ReadTime #}
{%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post.readstring | default(value="min") }}
{#- divider #}
{%- if config.extra.meta_post.date or config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
{%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }}
{#- divider #}
{%- if config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
{%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %}
{#- Tags #}
{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span>
{%- endmacro meta_post %}
{%- macro title_index(page) %}
<h1>{% if config.extra.title_size_index %}<span class="{{ config.extra.title_size_index }}">{% endif %}<a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a>{% if config.extra.title_size_index %}</span>{% endif %}</h1>
{%- endmacro title_index %}
{%- macro meta_index(page) %}
<span{%- if config.extra.meta_index.size %} class="{{ config.extra.meta_index.size }}"{% endif %}>
{#- Author #}
{%- if page.taxonomies.authors and config.taxonomies %}
{%- for author in page.taxonomies.authors %}
{%- if author_flag %} and {% endif %}
<a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a>
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif config.extra.author and config.extra.meta_index.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }}
{%- endif %}
{#- divider #}
{%- if config.extra.meta_index.author %}
{%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}
{%- endif %}
{%- endif %}
{#- ReadTime #}
{%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index.readstring | default(value="min") }}
{#- divider #}
{%- if config.extra.meta_index.date or config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
{%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }}
{#- divider #}
{%- if config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
{%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %}
{#- Tags #}
{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span>
{%- endmacro meta_index %}
{%- macro footer(page) %}
<p><b><a href="#">Back to top</a></b></p>
{%- endmacro footer %}
{%- macro pagination(paginator)%}
{%- if paginator.number_pagers > 1 %}
{%- if paginator.number_pagers <= 5 %} {# 5 or less pager is simple, just display all 5 #}
{%- set start = 1 %}
{%- set end = paginator.number_pagers %}
{%- endif %}
{%- if paginator.number_pagers > 5 %}
{%- if paginator.current_index >= 3 %} {# Check if the first number will be 1 or not #}
{%- set start = paginator.current_index - 2 %} {# Set the start number #}
{%- if paginator.number_pagers - paginator.current_index < 2 %} {# the last two pages your no longer centered with equal pages start and end #}
{%- set difference = paginator.number_pagers - paginator.current_index %}
{%- set compensation = 1 - difference %}
{%- set start = paginator.current_index - 3 - compensation %} {# however many pages are missing on the end, add offset to start #}
{%- endif %}
{%- else %}
{%- set start = 1 %}
{%- endif %}
{%- if paginator.number_pagers >= paginator.current_index + 2 %} {# Check if the last page is beyond our range #}
{%- set end = paginator.current_index + 2 %} {# End is beyond our range so we can safely set it to our range #}
{%- if paginator.current_index <= 3 %} {# check offset start, if on page 1 or 2 then set the end to page 5 #}
{%- set end = 5 %}
{%- endif %}
{%- else %}
{%- set end = paginator.number_pagers %}
{%- endif %}
{%- endif %}
<nav>
<ul>
{% if paginator.previous %}<li><a href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">| <</a></li>{% else %}<li><span class="off">| <</span></li>{% endif %}
{% if paginator.previous %}<li><a href="{{ paginator.previous | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}"><</a></li>{% else %}<li><span class="off"><</span></li>{% endif %}
{%- for i in range(start=start, end=end+1) %}
<li>
{%- if i == paginator.current_index -%}
<a class="cnav" href="#">{{i}}</a>
{%- elif i > 1 -%}
<a href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{i}}</a>
{%- else -%}
<a href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ i }}</a>
{%- endif -%}
</li>
{%- endfor %}
{% if paginator.next %}<li><a href="{{ paginator.next | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">></a></li>{% else %}<li><span class="off">></span></li>{% endif %}
{% if paginator.next %}<li><a href="{{ paginator.last | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">> |</a></li>{% else %}<li><span class="off">> |</span></li>{% endif %}
</ul>
</nav>
{%- endif %}
{%- endmacro %}
|