-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclarity-sidebar.html
69 lines (68 loc) · 2.67 KB
/
clarity-sidebar.html
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
<?php $pages = $this->yellow->content->index()->filter("layout", "blog")->sort("published", false)->limit(20) ?>
<?php
$tags = array();
$recents = null;
$recentCounter = 0;
foreach ($pages as $page) {
if ($recentCounter++<5) {
$recents .= "<li><a href=\"".$page->getLocation(true)."\" class=\"nav-link\">".$page->getHtml("title")."</a></li>";
}
if ($page->isExisting("tag")) {
foreach (preg_split("/\s*,\s*/", $page->get("tag")) as $entry) {
if (!isset($tags[$entry])) $tags[$entry] = 0;
++$tags[$entry];
}
}
}
?>
<aside class="sidebar">
<?php if ($this->yellow->extension->isExisting("search")): ?>
<section class="sidebar_inner">
<!-- Search -->
<div>
<form class="search-form" action="<?php echo $this->yellow->page->getBase() ?>/search/" method="post">
<div class="search_wrapper">
<input class="search_input" type="text" name="query" value="<?php echo $this->yellow->page->getRequestHtml("query") ?>"<?php echo $this->yellow->page->get("status")=="none" ? " autofocus=\"autofocus\"" : "" ?> />
<button type="submit" class="search_btn"><svg class="icon search_btn" style="width: 36px;height: 30px;"><use xlink:href="#search"></use></svg></button>
<input type="hidden" name="clean-url" />
</div>
</form>
</div>
</section>
<?php endif ?>
<section class="sidebar_inner">
<!-- About widget -->
<h2>About</h2>
<div class="sidebar_description">
Technologist, perpetual student, teacher, continual incremental improvement.
</div>
</section>
<section class="sidebar_inner">
<!-- Recent posts widget -->
<h2 class="mt-4">Recent Posts</h2>
<ul class="flex-column">
<?php echo $recents ?>
</ul>
</section>
<section class="sidebar_inner">
<!-- Tags widget -->
<div>
<h2 class="mt-4 taxonomy" id="tags-section">Tags</h2>
<nav class="tags_nav">
<?php
$output = null;
if (count($tags)) {
uasort($tags, "strnatcasecmp");
uksort($tags, "strnatcasecmp");
$output .= "<ul>\n";
foreach ($tags as $key=>$value) {
$output .= "<a href=\"".$this->yellow->page->getBase()."/blog/".$this->yellow->toolbox->normaliseArguments("tag:$key")." \" class=\"post_tag button button_translucent\">".$key."<span class=\"button_tally\">".$value."</span></a>";
}
$output .= "\n";
}
echo $output;
?>
</nav>
</div>
</section>
</aside>