Skip to content

Commit

Permalink
got sidebar toc working and implemented kramdown toc
Browse files Browse the repository at this point in the history
  • Loading branch information
elotroalex committed Feb 1, 2016
1 parent 380a362 commit c944fd2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
11 changes: 8 additions & 3 deletions _includes/sidebar-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
<nav class="sidebar-nav">
<a class="sidebar-nav-item{% if page.url == site.baseurl %} active{% endif %}" href="{{ site.baseurl }}/">Return Home</a>
<a class="sidebar-nav-item" href="https://via.hypothes.is/http://elotroalex.github.io/ed/">Annotate me</a>
<span class="sidebar-nav-item">Table of contents</span>
{% for node in page.toc %}
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="#{{ node | slugify }}">{{ node }}</a>
{% endfor %}



{% comment %}
The code below dynamically generates a sidebar nav of chapters. See documentation for details.
The code below dynamically generates a sidebar nav of chapters.
{% endcomment %}

<!--
<span class="sidebar-nav-item">TABLE OF CONTENTS</span>
{% assign chapters = "Title Page|Preface|Letter From Wendell Phillips|Chapter I|Chapter II|Chapter III|Chapter IV|Chapter V|Chapter VI|Chapter VII|Chapter VIII|Chapter IX|Chapter X|Chapter XI|Appendix|A Parody" | split: "|" %}
{% for node in chapters %}
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="#{{ node | slugify }}">{{ node }}</a>
{% endfor %}
{% endfor %} -->

</nav>

Expand Down
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<body>

<!-- This if statement decides which sidebar to use -->
{% if page.layout == 'narrative' || 'drama' %}
{% if page.toc %}
{% include sidebar-toc.html %}
{% else %}
{% include sidebar.html %}
Expand Down
24 changes: 23 additions & 1 deletion _posts/2016-01-16-narrative.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,33 @@ title: "The Narrative of the Life of Frederick Douglass"
author: Frederick Douglass
rights: Public Domain
source: Project Guttenberg
sidebar: yes
toc:
- Title Page
- Preface
- Letter From Wendell Phillips
- Chapter I
- Chapter II
- Chapter III
- Chapter IV
- Chapter V
- Chapter VI
- Chapter VII
- Chapter VIII
- Chapter IX
- Chapter X
- Chapter XI
- Appendix
- A Parody
---

<p class="citation"> by {{ page.author }}</p>

## Contents
{:.no_toc}

* ToC
{:toc}


---

Expand Down

0 comments on commit c944fd2

Please sign in to comment.