-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.twig
596 lines (537 loc) · 23.3 KB
/
index.twig
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
{#
NotePaper v1.5.4
http://development.mayamcdougall.me/pico-themes/NotePaper
https://github.com/mayamcdougall/NotePaper
#}
<!DOCTYPE html>
<html lang="en">
<head>
{# Metadata #}
<meta charset="utf-8">
<title>{% if meta.title and not ((is_front_page and config.NotePaper.front_page.enabled) or TwigGetUrl.search or TwigGetUrl.tag) %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
{% if meta.description %}<meta name="description" content="{{ meta.description }}">{% endif %}
{% if meta.robots %}<meta name="robots" content="{{ meta.robots }}">{% endif %}
{# Styles #}
{# Google Fonts #}
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro%7CForum%7CKalam:400,700' rel='stylesheet' type='text/css'>
{# Custom Fonts #}
{% if config.NotePaper.css.fonts %}
{% for url in config.NotePaper.css.fonts %}
<link href='{{ url }}' rel='stylesheet' type='text/css'>
{% endfor %}
{% endif %}
{# Main Stylesheet #}
<link rel="stylesheet" href="{{ theme_url }}/style.css" type="text/css">
{% if config.NotePaper.css.animations %}<link rel="stylesheet" href="{{ theme_url }}/animations.css" type="text/css">{% endif %}
{# Custom NotePaper Themes #}
{% if config.NotePaper.css.theme and not meta.theme %}
<link rel="stylesheet" href="{{ base_url }}/assets/NotePaper_Themes/{{ config.NotePaper.css.theme }}/theme.css" type="text/css">
{% if config.NotePaper.css.animations %}<link rel="stylesheet" href="{{ base_url }}/assets/NotePaper_Themes/{{ config.NotePaper.css.theme }}/animations.css" type="text/css">{% endif %}
{% elseif meta.theme and meta.theme != "Default" %}
<link rel="stylesheet" href="{{ base_url }}/assets/NotePaper_Themes/{{ meta.theme }}/theme.css" type="text/css">
{% if config.NotePaper.css.animations %}<link rel="stylesheet" href="{{ base_url }}/assets/NotePaper_Themes/{{ meta.theme }}/animations.css" type="text/css">{% endif %}
{% endif %}
{# User Style Overrides #}
{% if config.NotePaper.css.override %}
<link rel="stylesheet" href="{{ base_url }}/{{ config.NotePaper.css.override }}" type="text/css">
{% endif %}
{% if meta.css_override %}
<link rel="stylesheet" href="{{ base_url }}/{{ meta.css_override }}" type="text/css">
{% endif %}
{# Modernizr #}
<script src="{{ theme_url }}/scripts/modernizr.js"></script>
{# Description Length #}
{% if config.NotePaper.description_length %}
{% set description_length = config.NotePaper.description_length %}
{% else %}
{% set description_length = 255 %}
{% endif %}
{# Open Graph #}
<meta property="og:url" content="{{ current_page.url }}">
<meta property="og:site_name" content="{{ site_title }}">
<meta property="og:type" content="website">
{% if meta.title and not ((is_front_page and config.NotePaper.front_page.enabled) or TwigGetUrl.search or TwigGetUrl.tag) %}<meta property="og:title" content="{{ meta.title }}">{% endif %}
{% if meta.description %}
<meta property="og:description" content="{{ meta.description }}">
{% elseif not ((is_front_page and config.NotePaper.front_page.enabled) or TwigGetUrl.search or TwigGetUrl.tag) %}
{% if content|striptags|length > description_length %}
<meta property="og:description" content="{{ content|striptags|slice(0,description_length)|split(' ',-1)|join(' ') ~ "..." }}">
{% else %}
<meta property="og:description" content="{{ content|striptags }}">
{% endif %}
{% endif %}
{% if config.NotePaper.og_image %}<meta property="og:image" content="{{ base_url }}/{{ config.NotePaper.og_image }}">{% endif %}
{# Facebook Coments Administration #}
{% if config.NotePaper.comments.type == "facebook" %}
{% if config.NotePaper.comments.admin_type == "user" %}
{% for users in config.NotePaper.comments.admin_id %}
<meta property="fb:admins" content="{{ users }}">
{% endfor %}
{% elseif config.NotePaper.comments.admin_type == "app" %}
<meta property="fb:app_id" content="{{ config.NotePaper.comments.admin_id }}">
{% endif %}
<noscript><style>.fb-comments:before {content: 'Please enable JavaScript to view the Facebook Comments.';} .fb-comments {text-align: center;}</style></noscript>
{% endif %}
</head>
<body>
{# Show YAML Errors #}
{% for page in pages if page.meta.YAML_ParseError %}
<p class="yaml_error">Header Error in <a href="{{ page.url }}">{{ page.id }}</a>, {{ page.meta.YAML_ParseError }}</p>
{% endfor %}
{# Header #}
<header class="site_title">
<h1>
<a href="{{ base_url }}">
{% if config.NotePaper.site_logo %}
<img src="{{ base_url }}/{{ config.NotePaper.site_logo }}" alt="{{ site_title }}">
{% else %}
{{ site_title }}
{% endif %}
</a>
</h1>
</header>
<main>
{# NotePaper Pages #}
{% set np_pages = [] %}
{% for page in pages if not page.meta.widget and not (config.NotePaper.front_page.enabled and page.id == "index") %}
{% set np_pages = np_pages|merge([page]) %}
{% endfor %}
{# Experimental Folder Navigation - First Level Calculation #}
{% if config.NotePaper.toc.folder %}
{% set first_level = [] %}
{% for page in np_pages if not page.meta.blog %}
{% if '/' in page.id and (page.id|split('/')|first) not in first_level %}
{% set first_level = first_level|merge([page.id|split('/')|first]) %}
{% endif %}
{% endfor %}
{% endif %}
{# Macros #}
{# Recursive Navigation #}
{% import _self as macros %}
{% macro rnav(toc,is_child) %}
{% import _self as macros %}
<ul>
{% for sectionKey, section in toc %}
{% if section is iterable %}
<li>
<a href="#{{ sectionKey }}">{{ section|first }}</a>
{{ macros.rnav(section,true) }}
</li>
{% elseif not (is_child and loop.first) %}
<li>
<a href="#{{ sectionKey }}">{{ section }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endmacro %}
{# Experimental Recursive Folder Navigation #}
{% macro rfol(ToC,np_pages,sticky_num,config) %}
{% import _self as macros %}
{% set sticky_num = sticky_num + 1 %}
{% set next_level = [] %}
{% set current_level = [] %}
{% for page in np_pages if not page.meta.blog and page.id starts with ToC %}
{% set current_level = current_level|merge([page.id|slice(ToC|length + 1)]) %}
{% endfor %}
{% for page in current_level %}
{% if '/' in page and (ToC ~ '/' ~ page|split('/')|first) not in next_level %}
{% set next_level = next_level|merge([ToC ~ '/' ~ page|split('/')|first]) %}
{% endif %}
{% endfor %}
{% for nToC in next_level %}
<li class="menu-header">
{{ nToC|split('/')|last|replace({"_": " "})|title }}
<ul class="menu{% if sticky_num is odd %} odd{% endif %}">
<li class="menu-title"><h2>{{ nToC|split('/')|last|replace({"_": " "})|title }}</h2></li>
{{ macros.rfol(nToC,np_pages,sticky_num,config) }}
</ul>
</li>
{% endfor %}
{% for page in np_pages if not page.meta.blog and page.id starts with ToC %}
{% if next_level %}
{% set pass = true %}
{% for nToC in next_level %}
{% if (page.id starts with nToC) %}{% set pass = false %}{% endif %}
{% endfor %}
{% if pass == true %}
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
{% endif %}
{% else %}
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
{% endif %}
{% endfor %}
{% endmacro %}
{# Widgets Sidebar #}
{# Navigation #}
<section class="widgets{% if config.NotePaper.css.mirrorwidgets %} mirrorwidgets{% endif %}">
{% if config.NotePaper.css.mirrorwidgets %}
{% set sticky_num = 1 %}
{% endif %}
{% if not config.NotePaper.disable.toc %}
<nav class="toc{% if sticky_num is odd %} odd{% endif %}">
{% set sticky_num = sticky_num + 1 %}
{% if config.NotePaper.toc.text %}<h2>{{ config.NotePaper.toc.text }}</h2>{% endif %}
<ul>
{% for page in np_pages if not page.meta.blog and not (config.NotePaper.toc.folder and page.id|split('/')|first in first_level) %}
<li>
<a {% if page.id == current_page.id %}class="current_page"{% endif %} href="{{ page.url }}">{{ page.title }}</a>
{% if page.id == current_page.id and page.meta.toc %}
{{ macros.rnav(page.meta.toc) }}
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
{# Experimental Folder Navigation #}
{% if config.NotePaper.toc.folder %}
{% for ToC in first_level %}
<nav class="toc foldertoc{% if sticky_num is odd %} odd{% endif %}">
{% set sticky_num = sticky_num + 1 %}
<h2>{{ ToC|replace({"_": " "})|title }}</h2>
<ul>
{{ macros.rfol(ToC,np_pages,sticky_num,config) }}
</ul>
</nav>
{% endfor %}
{% endif %}
{# Tag Data #}
{% if config.NotePaper.tags.list or config.NotePaper.tags.cloud %}
{% set tag_cloud = {} %}
{% for page in np_pages if page.meta.tags %}
{% for tag in page.meta.tags|split(',') %}
{% set tag_cloud = tag_cloud|merge({(tag): (tag_cloud[tag] + 1)}) %}
{% endfor %}
{# Alphabetical Order #}
{% if config.NotePaper.tags.sort.method == 'alphabetical' %}
{% set tag_cloud_alphabetical = {} %}
{% for tag in tag_cloud|keys|sort %}
{% set tag_cloud_alphabetical = tag_cloud_alphabetical|merge({(tag): tag_cloud[tag] }) %}
{% if loop.last %}
{% if not config.NotePaper.tags.sort.reverse %}
{% set tag_cloud = tag_cloud_alphabetical %}
{% else %}
{% set tag_cloud = tag_cloud_alphabetical|reverse %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{# Numerical Order #}
{% if config.NotePaper.tags.sort.method == 'numerical' %}
{% set tag_cloud_numerical = {} %}
{% for tag,total in tag_cloud|sort %}
{% set tag_cloud_numerical = tag_cloud_numerical|merge({(tag): total }) %}
{% if loop.last %}
{% if config.NotePaper.tags.sort.reverse %}
{% set tag_cloud = tag_cloud_numerical %}
{% else %}
{% set tag_cloud = tag_cloud_numerical|reverse %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{# Tag List #}
{% if config.NotePaper.tags.list.enabled and tag_cloud %}
<nav class="tag_list{% if sticky_num is odd %} odd{% endif %}">
{% set sticky_num = sticky_num + 1 %}
{% if config.NotePaper.tags.list.title %}<h2>{{ config.NotePaper.tags.list.title }}</h2>{% endif %}
<ul>
{% for tag,total in tag_cloud %}
<li>
<a href="{% if TwigGetUrlEnabled %}{{ base_url ~ '?tag=' ~ tag }}{% endif %}">{{ tag }}
{% if config.NotePaper.tags.list.total %}
({{ total }})
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
{# Tag Cloud #}
{% if config.NotePaper.tags.cloud.enabled and tag_cloud %}
{# Levels Validation #}
{% if config.NotePaper.tags.cloud.levels < 1 %}
{% set levels = 5 %}
{% else %}
{% set levels = config.NotePaper.tags.cloud.levels %}
{% endif %}
{% if max(tag_cloud) < levels %}
{% set levels = max(tag_cloud) %}
{% endif %}
{% set level_range = (max(tag_cloud) / levels)|round(0,'ceil') %}
{# Render Tag Cloud #}
<nav class="tag_cloud{% if sticky_num is odd %} odd{% endif %}">
{% set sticky_num = sticky_num + 1 %}
{% if config.NotePaper.tags.cloud.title %}<h2>{{ config.NotePaper.tags.cloud.title }}</h2>{% endif %}
<ul>
{% for tag,total in tag_cloud %}
{% for i in range(levels, 0) %}
{% if total in range(max(tag_cloud) - (level_range * (loop.index0)), max(tag_cloud) - (level_range * (loop.index)) + 1) %}
<li style="font-size:{{ 2 - (loop.index0 * (1.5 / levels)) }}em;">
<a href="{% if TwigGetUrlEnabled %}{{ base_url ~ '?tag=' ~ tag }}{% endif %}">{{ tag }}
{% if config.NotePaper.tags.cloud.total %}
({{ total }})
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
</nav>
{% endif %}
{# Widgets #}
{% for page in pages if page.meta.widget and page.meta.widget != "Disabled" %}
<nav class="{% if page.meta.widget == "Sticky" and sticky_num is odd %}odd {% endif %}{% if page.meta.widget == "Doodle" %}doodle{% endif %}">
{% if page.meta.widget == "Sticky" %}{% set sticky_num = sticky_num + 1 %}{% endif %}
{{ page.id|content }}
</nav>
{% endfor %}
</section>
{# Content Rendering #}
{# Pagination Math #}
{% if is_front_page and (config.NotePaper.front_page.enabled or TwigGetUrl.search or TwigGetUrl.tag) %}
{# Page Count #}
{% set total_pages = '' %}
{% for page in np_pages if (not TwigGetUrl.search or TwigGetUrl.search and (TwigGetUrl.search|lower in page.title|lower or TwigGetUrl.search|lower in page.description|lower or TwigGetUrl.search|lower in page.id|content|lower)) and (not TwigGetUrl.tag or TwigGetUrl.tag in page.meta.tags|split(',')) %}
{% set total_pages = (loop.index / config.NotePaper.front_page.limit)|round(0,'ceil') %}
{% endfor %}
{# Out of Bounds Check #}
{% if TwigGetUrl and TwigGetUrl.page not in range(2, total_pages) %}
{% set TwigGetUrl = TwigGetUrl|merge({page: ''}) %}
{% endif %}
{# Page Offset #}
{% if TwigGetUrl.page > 0 %}
{% set offset = config.NotePaper.front_page.limit * (TwigGetUrl.page - 1) %}
{% else %}
{% set offset = 0 %}
{% endif %}
{% endif %}
{# Search and Tag - Number of Results #}
{% if TwigGetUrl.search or TwigGetUrl.tag %}
{% set numresults = '' %}
{% for page in np_pages if (not TwigGetUrl.search or TwigGetUrl.search|lower in page.title|lower or TwigGetUrl.search|lower in page.description|lower or TwigGetUrl.search|lower in page.id|content|lower) and (not TwigGetUrl.tag or TwigGetUrl.tag in page.meta.tags|split(',')) %}
{% set numresults = loop.index %}
{% endfor %}
{% endif %}
{# Loop #}
{% set regularpage = '' %}
{% for page in np_pages if not regularpage and (not is_front_page or (not TwigGetUrl.search or TwigGetUrl.search and (TwigGetUrl.search|lower in page.title|lower or TwigGetUrl.search|lower in page.description|lower or TwigGetUrl.search|lower in page.id|content|lower)) and (not TwigGetUrl.tag or TwigGetUrl.tag in page.meta.tags|split(','))) %}
{% if loop.index > offset and count < config.NotePaper.front_page.limit %}
{% set count = count + 1 %}
{% if not is_front_page or is_front_page and not (config.NotePaper.front_page.enabled or TwigGetUrl.search or TwigGetUrl.tag) %}
{% set pagetype = 'meta' %}
{% set regularpage = true %}
{% else %}
{% set pagetype = 'page' %}
{% endif %}
<article>
{% if loop.index > offset + 1 %}<hr>{% endif %}
{% if not config.NotePaper.disable.header and ((_context[pagetype].date and not config.NotePaper.disable.date) or (_context[pagetype].title))%}
<header>
{% if _context[pagetype].date and not config.NotePaper.disable.date %}<h4 class="date{% if config.NotePaper.css.mirrorwidgets %} mirrordate{% endif %}">{{ _context[pagetype].date|date("F<\\b\\r>jS") }}</h4>{% endif %}
{% if _context[pagetype].title %}
<h2 class="title"><a href="{{ _context[pagetype].url }}">{{ _context[pagetype].title }}</a></h2>
{% if _context[pagetype].author %}<h3 class="author"> by: {{ _context[pagetype].author }}</h3>{% endif %}
{% endif %}
</header>
{% if _context[pagetype].title %}<hr>{% endif %}
{% endif %}
{% if pagetype == "page" and not TwigGetUrl.search and not TwigGetUrl.tag %}
{{ page.id|content }}
{% elseif is_front_page and (TwigGetUrl.search or TwigGetUrl.tag) %}
{% if page.description %}
{{ page.description }}
{% else %}
{% if page.id|content|striptags|length > description_length %}
{{ page.id|content|striptags|slice(0,description_length)|split(' ',-1)|join(' ') ~ "..." }}
{% else %}
{{ page.id|content|striptags }}
{% endif %}
{% endif %}
{% else %}
{{ content }}
{% endif %}
</article>
{% endif %}
{% endfor %}
{# Bottom Links #}
{% if ((config.NotePaper.bottom_links.enabled and config.NotePaper.bottom_links.enabled ~ '' != "blog") or (config.NotePaper.bottom_links.enabled ~ '' == "blog" and meta.blog)) and regularpage and not (is_front_page and config.NotePaper.disable.front_page_buttons) or is_front_page and ((config.NotePaper.front_page.enabled and TwigGetUrlEnabled and not config.NotePaper.disable.front_page_buttons) or TwigGetUrl.search or TwigGetUrl.tag) %}
{% set url = "" %}
{% for page in np_pages if config.NotePaper.bottom_links.enabled ~ '' != "blog" or (config.NotePaper.bottom_links.enabled ~ '' == "blog" and meta.blog and page.meta.blog) or is_front_page %}
{% if loop.index == 1 %}
{% set first_url = page.url %}
{% elseif page.id == current_page.id %}
{% set prev_url = buffer.url %}
{% elseif buffer.id == current_page.id %}
{% set next_url = page.url %}
{% endif %}
{% set last_url = page.url %}
{% set buffer = {id: page.id, url: page.url} %}
{% set url = {
first: {
url: first_url,
text: config.NotePaper.bottom_links.first.text,
image: config.NotePaper.bottom_links.first.image
},
prev: {
url: prev_url,
text: config.NotePaper.bottom_links.prev.text,
image: config.NotePaper.bottom_links.prev.image
},
top: {
url: "#",
text: config.NotePaper.bottom_links.top.text,
image: config.NotePaper.bottom_links.top.image
},
next: {
url: next_url,
text: config.NotePaper.bottom_links.next.text,
image: config.NotePaper.bottom_links.next.image
},
last: {
url: last_url,
text: config.NotePaper.bottom_links.last.text,
image: config.NotePaper.bottom_links.last.image
},
separator: {
text: config.NotePaper.bottom_links.separator.text,
image: config.NotePaper.bottom_links.separator.image
}
} %}
{% endfor %}
{# Load Default Images #}
{% for key,link in url if link.image == "default" %}
{% set url = url|merge({(key): link|merge({image: theme_url|slice(base_url|length) ~ "/images/buttons/button_" ~ key ~ ".png"})}) %}
{% endfor %}
{# Front Page URLs #}
{% if is_front_page and (config.NotePaper.front_page.enabled or TwigGetUrl.search or TwigGetUrl.tag) %}
{# Search Query #}
{% if TwigGetUrl.search %}
{% set search = 'search=' ~ TwigGetUrl.search %}
{% endif %}
{# Tag Query #}
{% if TwigGetUrl.tag %}
{% set tag = 'tag=' ~ TwigGetUrl.tag %}
{% endif %}
{# Page Math #}
{% if TwigGetUrl.page > 2 %}
{% set prev_url = 'page=' ~ (TwigGetUrl.page - 1) %}
{% endif %}
{% if (TwigGetUrl.page + 1) < total_pages %}
{% if TwigGetUrl.page < 2 %}
{% set next_url = 'page=' ~ (TwigGetUrl.page + 2) %}
{% else %}
{% set next_url = 'page=' ~ (TwigGetUrl.page + 1) %}
{% endif %}
{% else %}
{% set next_url = 'page=' ~ total_pages %}
{% endif %}
{% set last_url = 'page=' ~ total_pages %}
{# Set URLs #}
{% for key,link in url if key != "separator" and key != "top" %}
{% if _context[key ~ '_url'] or search or tag %}
{% set operand = '?' %}
{% endif %}
{% if _context[key ~ '_url'] and search %}
{% set ampersand = '&' %}
{% endif %}
{% if _context[key ~ '_url'] and tag %}
{% set ampersand2 = '&' %}{# Kind of awful #}
{% endif %}
{% set url = url|merge({(key): url[key]|merge({url: (base_url ~ operand ~ _context[key ~ '_url'] ~ ampersand ~ search ~ ampersand2 ~ tag) })}) %}
{% endfor %}
{% endif %}
{# Search Result And Tag Math #}
{% if TwigGetUrl.search or TwigGetUrl.tag %}
{% if TwigGetUrl.page < 2 %}
{% set firstresult = 1 %}
{% set secondresult = config.NotePaper.front_page.limit %}
{% else %}
{% set firstresult = config.NotePaper.front_page.limit * (TwigGetUrl.page - 1)+ 1 %}
{% set secondresult = config.NotePaper.front_page.limit * (TwigGetUrl.page - 1) + config.NotePaper.front_page.limit %}
{% endif %}
{% if secondresult > numresults %}
{% set secondresult = numresults %}
{% endif %}
{% endif %}
{# Render Bottom Links #}
<section class="bottom_links">
<hr>
{# Number of Search Results #}
{% if numresults and is_front_page %}
<p>
Showing
{% if firstresult != secondresult %}
{{ firstresult }} - {{ secondresult }}
{% else %}
{{ firstresult }}
{% endif %}
of {{ numresults }} results.
</p><hr style="width: 30%; margin: 2em auto;">
{% elseif is_front_page and TwigGetUrl.search %}
<p>No Results =(</p><hr>
{% endif %}
{# Links #}
{% for key,link in url if link.text and key != "separator" %}
{% if loop.index == 1 %}
{% set precount = "0" %}
{% for key,link in url if link.text and key != "separator" %}{% set precount = precount + 1 %}{% endfor %}
{% endif %}
{% set count = count + 1 %}
{% if link.image %}
<a href="{{ link.url }}"><img src="{{ base_url }}/{{ link.image }}" alt="{{ link.text }}" title="{{ link.text }}"></a>
{% else %}
<a href="{{ link.url }}">{{ link.text }}</a>
{% endif %}
{% if count < precount %}
{% if url.separator.image %}
<img src="{{ base_url }}/{{ url.separator.image }}" alt="{{ url.separator.text }}">
{% else %}
{{ url.separator.text }}
{% endif %}
{% endif %}
{% endfor %}
</section>
{% endif %}
<br class="clear_widgets">
</main>
{# Disqus Comments #}
{% if config.NotePaper.comments.type == "disqus" and (not is_front_page or config.NotePaper.comments.front) %}
<section id="disqus_thread" class="comments">
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = '{{ config.NotePaper.comments.shortname }}';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</section>
{# Facebook Comments #}
{% elseif config.NotePaper.comments.type == "facebook" and (not is_front_page or config.NotePaper.comments.front) %}
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<section class="fb-comments comments" data-colorscheme="{% if config.NotePaper.comments.dark %}dark{% endif %}" data-href="{{ current_page.url }}" data-width="100%" data-numposts="{{ config.NotePaper.comments.limit }}" data-order-by="{{ config.NotePaper.comments.order }}"></section>
{% endif %}
{# Footer #}
<footer>
{% if config.NotePaper.copyright %}<h2 class="copyright">{{ config.NotePaper.copyright }}</h2>{% endif %}
{# Feel free to comment out this line #}<h3 class="credit"><a href="http://development.mayamcdougall.me/pico-themes/NotePaper/">NotePaper Theme</a> by <a href="https://github.com/mayamcdougall">Maya McDougall</a>.<br><a href="https://github.com/mayamcdougall/NotePaper">Contribute on GitHub</a>.</h3>
</footer>
</body>
</html>