Skip to content

Commit ee2b1d3

Browse files
committed
feat: added table of contents
1 parent 82c121f commit ee2b1d3

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
lines changed

Gemfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
source "https://rubygems.org/"
22

33
gem 'jekyll', '~>4.0'
4-
gem 'jekyll-sitemap'
5-
gem 'jekyll-compose'
64

75
group :jekyll_plugins do
86
gem 'jekyll-last-modified-at'
9-
107
gem "jekyll-redirect-from", "~> 0.16.0"
11-
128
gem 'jekyll-pug'
13-
149
gem 'jekyll-feed'
10+
gem 'jekyll-sitemap'
11+
gem 'jekyll-compose'
12+
gem 'jekyll-toc'
1513
end
1614

Gemfile.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ GEM
4848
sass-embedded (~> 1.54)
4949
jekyll-sitemap (1.4.0)
5050
jekyll (>= 3.7, < 5.0)
51+
jekyll-toc (0.18.0)
52+
jekyll (>= 3.9)
53+
nokogiri (~> 1.12)
5154
jekyll-watch (2.2.1)
5255
listen (~> 3.0)
5356
kramdown (2.4.0)
@@ -61,6 +64,10 @@ GEM
6164
memoist (0.16.2)
6265
mercenary (0.4.0)
6366
method-not-implemented (1.0.1)
67+
mini_portile2 (2.8.4)
68+
nokogiri (1.15.4)
69+
mini_portile2 (~> 2.8.2)
70+
racc (~> 1.4)
6471
pathutil (0.16.2)
6572
forwardable-extended (~> 2.6)
6673
posix-spawn (0.3.15)
@@ -70,6 +77,7 @@ GEM
7077
memoist (~> 0.15)
7178
method-not-implemented (~> 1.0, >= 1.0.1)
7279
regexp-match-polyfill (~> 1.0, >= 1.0.2)
80+
racc (1.7.1)
7381
rake (13.0.6)
7482
rb-fsevent (0.11.2)
7583
rb-inotify (0.10.1)
@@ -97,6 +105,7 @@ DEPENDENCIES
97105
jekyll-pug
98106
jekyll-redirect-from (~> 0.16.0)
99107
jekyll-sitemap
108+
jekyll-toc
100109

101110
BUNDLED WITH
102111
2.1.0

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ plugins:
4040
- jekyll-pug
4141
- jekyll-feed
4242
- jekyll-sitemap
43+
- jekyll-toc

_includes/post.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ <h1 class="card-title"><a href="{{ page.url }}">{{ page.title }}</a></h1>
1717
</div>
1818
</header>
1919

20+
{% if page.toc %}
21+
<details class="toc small">
22+
<summary class="py-2 font-weight-bold">Table of Contents</summary>
23+
<div class="mt-2">
24+
{{ include.content | toc_only }}
25+
</div>
26+
</details>
27+
{% endif %}
28+
2029
<div class="post-content" itemprop="articleBody">
21-
{{ include.content }}
30+
{{ include.content | inject_anchors }}
2231
</div>
2332

2433
<div class="footer">

_posts/2023-08-30-future-of-time-tracking.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: "The Future of Time Tracking: AI, Privacy, and Personalization"
44
date: 2023-08-30 15:57 +0200
55
author: "Erik Bjäreholt"
66
author_twitter: "ErikBjare"
7+
toc: true
78
---
89

910
## Introduction

_sass/_layout.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,10 @@
185185
}
186186
}
187187
}
188+
189+
.toc {
190+
border: 1px solid $grey-color-light;
191+
border-collapse: collapse;
192+
border-radius: 3px;
193+
margin: $spacing-unit 0;
194+
}

0 commit comments

Comments
 (0)