]> git.bitcoin.ninja Git - blog/commitdiff
Add sidebar
authorMatt Corallo <git@bluematt.me>
Fri, 15 Jan 2016 19:38:33 +0000 (11:38 -0800)
committerMatt Corallo <git@bluematt.me>
Fri, 15 Jan 2016 19:38:33 +0000 (11:38 -0800)
_includes/sidebar.html [new file with mode: 0644]

diff --git a/_includes/sidebar.html b/_includes/sidebar.html
new file mode 100644 (file)
index 0000000..cbca60e
--- /dev/null
@@ -0,0 +1,34 @@
+<!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular
+     styles, `#sidebar-checkbox` for behavior. -->
+<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
+
+<!-- Toggleable sidebar -->
+<div class="sidebar" id="sidebar">
+  <div class="sidebar-item">
+    <p>{{ site.description }}</p>
+  </div>
+
+  <nav class="sidebar-nav">
+    <a class="sidebar-nav-item{% if page.url == site.baseurl %} active{% endif %}" href="{{ site.baseurl }}/">Home</a>
+
+    {% comment %}
+      The code below dynamically generates a sidebar nav of pages with
+      `layout: page` in the front-matter. See readme for usage.
+    {% endcomment %}
+
+    {% assign pages_list = site.pages | sort:"url" %}
+    {% for node in pages_list %}
+      {% if node.title != null %}
+        {% if node.layout == "page" %}
+          <a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ node.url }}">{{ node.title }}</a>
+        {% endif %}
+      {% endif %}
+    {% endfor %}
+  </nav>
+
+  <div class="sidebar-item">
+    <p>
+      &copy; {{ site.time | date: '%Y' }}. All rights reserved.
+    </p>
+  </div>
+</div>