From ed74a33fcd96acdc33f1c721332f3d41a53e72c0 Mon Sep 17 00:00:00 2001
From: Philipp Schneider <philipp.schneider.1@hu-berlin.de>
Date: Tue, 25 Mar 2025 16:50:07 +0100
Subject: [PATCH] Add table of content

---
 _config.yml           |  3 +++
 _layouts/default.html | 21 +++++++++++++++++++++
 css/main.scss         | 36 ++++++++++++++++++++++++++++++++++++
 syllabus.md           |  3 +++
 4 files changed, 63 insertions(+)

diff --git a/_config.yml b/_config.yml
index 3bbbe65..7f6ecf9 100644
--- a/_config.yml
+++ b/_config.yml
@@ -38,6 +38,9 @@ theme: minima
 plugins:
   - jekyll-feed
 
+kramdown:
+  toc_levels: 2..3  # Generates ToC for H2 and H3 headers
+
 # Exclude from processing.
 # The following items will not be processed, by default.
 # Any item listed under the `exclude:` key here will be automatically added to
diff --git a/_layouts/default.html b/_layouts/default.html
index e4ab96f..57e8459 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -7,6 +7,27 @@
 
     {% include header.html %}
 
+    <!DOCTYPE html>
+    <html lang="{{ page.lang | default: site.lang | default: "en" }}">
+      <head>
+        {% include head.html %}
+      </head>
+      <body>
+        <div class="page-content">
+          <div class="wrapper">
+            <aside class="toc-sidebar">
+              <nav id="toc"></nav>
+            </aside>
+            <main class="post-content">
+              {{ content }}
+            </main>
+          </div>
+        </div>
+        {% include footer.html %}
+        <script src="{{ "/assets/js/toc.js" | relative_url }}"></script>
+      </body>
+    </html>
+
     <div class="page-content">
       <div class="wrapper">
         {{ content }}
diff --git a/css/main.scss b/css/main.scss
index f2e566e..82b0cc9 100644
--- a/css/main.scss
+++ b/css/main.scss
@@ -51,3 +51,39 @@ $on-laptop:        800px;
         "layout",
         "syntax-highlighting"
 ;
+
+.toc-sidebar {
+    position: fixed;
+    left: 20px; /* Change to right: 20px; for right-side */
+    top: 100px;
+    width: 250px;
+    max-height: 80vh;
+    overflow-y: auto;
+    background: #f8f9fa;
+    padding: 15px;
+    border-radius: 5px;
+    font-size: 14px;
+  }
+  
+  .toc-sidebar nav {
+    position: relative;
+  }
+  
+  .toc-sidebar ul {
+    list-style-type: none;
+    padding-left: 0;
+  }
+  
+  .toc-sidebar li {
+    margin-bottom: 5px;
+  }
+  
+  .toc-sidebar a {
+    text-decoration: none;
+    color: #007bff;
+  }
+  
+  .toc-sidebar a:hover {
+    text-decoration: underline;
+  }
+  
\ No newline at end of file
diff --git a/syllabus.md b/syllabus.md
index 510f648..6a803bc 100644
--- a/syllabus.md
+++ b/syllabus.md
@@ -6,6 +6,9 @@ permalink: /
 
 # Programmieren für Historiker:innen II – Geistliche Karrieren im Alten Reich mit Linked Open Data erforschen (Python-Aufbaukurs)
 
+* Table of Contents
+{:toc}
+
 ## Allgemeine Informationen
 
 ### Kontakt der Ansprechperson
-- 
GitLab